-
Notifications
You must be signed in to change notification settings - Fork 124
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
tinydir_readfile returns -1 when file is a broken link #63
Comments
@asv22 Try the latest commit to see if it's fixed. |
Thanks, for me it works great now. beforeIf we have a link to an existing regular file, then file.is_dir=0, file.is_reg=1 nowIf we have a link to an existing regular file, then file.is_dir=0, file.is_reg=0 |
interesting; I guess to find the properties of the link target, you need
|
The second choice i will make. |
We had a related problem on Mac. The ifdefs before
|
I searched for manuals, and found lstat() is available in 4.2BSD.
|
Sorry for late pull request #70. I'll merge it unless it doesn't work fine for you. |
Problems with symbolic links bit me recently in Tcl, which bundles Tinydir and Minizip, see https://core.tcl-lang.org/tcl/tktview/22ab2ae64ab2dd813719a985a6f125631ab1ba74 . I'd like this:
Is that still the plan? It could be used in Minizip. |
To be honest, we (at least myself) had no such thing called plan on this project. We will appear when any bugs or issues are found, because:
Just kidding. I, myself, had never expected the project being used in any serious programs. (@cxong seems to use it in game, and I use it in personal project.) This is why when I made a dirty fix for this issue three years ago, although the API change is recognized, yet no actions were made to either fix the issue perfectly or prompt users to be aware of this API change. (If we used Semantic Versioning, the major version number should be increased.) Although that was a dirty fix, simply reverting the commit is another dirty fix, which make the original bug appear again. More to say, in my opinion, if you want to use some program seriously, complete test suites or units should be used to make sure it all works. And this project is surely lack of that. Thanks for your reporting, I would recently try to make this issue solved perfectly. |
I think an easy partial fix is to add the |
We may also add a |
According to man pages of ln(1) of UNIX v7 and 4BSD
This means the hard links don't matter. We need to process the symbolic links. According to man page of ln(1p) of POSIX.1-2008:
According to The GNU C Library Reference Manual, for version 2.36:
|
According to Microsoft Open Specifications: The .LNK file is called Shell Link (.LNK) Binary File Format. This is a file for shell, with no relation to UNIX link. In Microsoft Windows, there is mklink command which could create Hard Links and Junctions or Symbolic Links.
Then we need to consider the junction, which works like a symbolic link to another directory. |
I.e. a file, which you could create with
ln -s /broken/link .
In that case
iterate_sample.c
shows directory listing only partially. Andrandom_access_sample.c
fails to open a directory at line 8.tinydir_readfile
finishes at line 559 when processing a broken linkMy OS is Linux.
The text was updated successfully, but these errors were encountered: