-
Notifications
You must be signed in to change notification settings - Fork 0
info: show if package exists in store #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: D-Berg/packa
Length of output: 11127
🏁 Script executed:
Repository: D-Berg/packa
Length of output: 9350
🌐 Web query:
Zig std.Io.Dir.access error.NotFound API Zig 0.14 0.15💡 Result:
In Zig versions 0.14 and 0.15,
std.fs.Dir.accessis the standard function used to check for the existence or accessibility of a file or directory [1][2]. When the specified path does not exist, this function returnserror.FileNotFound[3][2]. API Usage and Best Practices The function signature ispub fn access(dir: Dir, io: Io, sub_path: []const u8, options: AccessOptions) AccessError!void(often accessed viastd.fs.cwd().access(...)) [3]. When using this function to check if a file exists, it is critical to handleerror.FileNotFoundexplicitly [2]. A common pitfall is the Time-Of-Check-To-Time-Of-Use (TOCTOU) race condition [1][4]. The official Zig documentation and community best practices strongly advise against usingaccessto check if a file exists before opening it [1][4][2]. Instead, you should simply attempt to open the file and handle theerror.FileNotFoundresult from the open operation itself [1][4][2]. This approach is more robust and prevents potential race conditions between the check and the actual file access [4][2]. Context for Zig 0.14/0.15 Zig has been undergoing significant refactoring of its standard library, including moving toward an updated I/O API [5][6][7]. Whilestd.fs.Dir.accessremains a standard component for path testing, some olderstd.fsmethods have been deprecated in favor of newerstd.Ioequivalents [7]. Always ensure you are checking the latest documentation for your specific Zig version, as the standard library continues to evolve [6]. If you encounter unexpected behavior, such as crashes or panics when passing specific paths (e.g., extremely long paths on Windows), be aware that these may be tracked as specific issues in the Zig issue tracker [8], rather than expected API behavior.Citations:
🌐 Web query:
site:github.com/ziglang/zig 0.16.0 lib/std/Io/Dir.zig access error.FileNotFound💡 Result:
In Zig 0.16.0, an error.FileNotFound returned by a function in lib/std/fs/Dir.zig (or lib/std/Io/Dir.zig) indicates that the requested file or directory path does not exist [1][2][3]. This error is a standard member of the error sets for various directory and file operations in the Zig standard library, including AccessError, OpenError, MakeError, and DeleteDirError [1][2][4]. If you are encountering this error when you believe the file should exist, consider the following common causes: 1. Incorrect Path: Verify that the sub_path provided to the function is correct relative to the Dir object being used [3]. 2. Race Conditions: If the file was expected to be created or accessed by another process, it may have been deleted or moved, resulting in a race condition [5][4]. 3. Permissions or Mounts: On some systems, especially when using tools like Wine or specific container environments, path resolution or permission settings can cause unexpected FileNotFound errors [6]. 4. Symlinks: If the path involves a symbolic link, ensure the target of the link exists and is accessible [3]. You can debug this by printing the path being accessed just before the call to ensure it matches your expectations, or by using std.fs.cwd.realpathAlloc(allocator, path) to resolve the absolute path for verification. If the error persists unexpectedly, check your operating system's specific behavior regarding the file system operations involved [6].
Citations:
Report the missing-store result explicitly.
When
accessreturnserror.FileNotFound, print an explicit missing status. Propagate or report all other errors instead of treating them as absence.🤖 Prompt for AI Agents