#3102 closed bug (invalid)
diff reports "Unknown system error"
Reported by: | bhaible | Owned by: | bonefish |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | Applications/Command Line Tools | Version: | R1/pre-alpha1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | x86 |
Description
Diff, when called to compare two small files on BeFS, reports "Unknwon system error".
It could be a bug in diff, or in libroot. Since diff is from GNU and well-tested for a decade, my guess is that a system call in libroot returned a failure indicator but did not set errno.
Attachments (4)
Change History (11)
by , 16 years ago
Attachment: | haiku-diff-bug.png added |
---|
comment:1 by , 16 years ago
Component: | - General → Applications/Command Line Tools |
---|---|
Owner: | changed from | to
I usually generate patches with diff in Haiku and haven't encountered this one yet. I just tried with a few small files and things worked as expected as well.
Can you attach the concerned files please. Also the output of an strace diff ...
might be helpful.
Regarding GNU software, you're right in general. One problem we've encountered in several instances is that it sometimes implicitly assumes that error codes are positive values, which is not the case in Haiku (and BeOS, which far predates the time this requirement was added to the POSIX standard, BTW). I wouldn't be too surprised if this was another of such instances.
follow-up: 3 comment:2 by , 16 years ago
Your guess about the negative errno value is right: According to the strace log, I had a typo in the filename ("freadhead.c", not "freadahead.c"), and the ENOENT errno was not properly converted to s text message like "No such file or directory", due to the private_strerror function in haiku/src/bin/diffutils/lib/error.c.
I will address this in the lib/error.c and lib/strerror.c from gnulib. But it would be good if you changed the errno values for POSIX compliance, in the medium term.
follow-up: 6 comment:3 by , 16 years ago
Replying to bhaible:
I will address this in the lib/error.c and lib/strerror.c from gnulib. But it would be good if you changed the errno values for POSIX compliance, in the medium term.
That realistically can't be changed at this point without breaking compat with pretty much every existing BeOS app.
follow-up: 5 comment:4 by , 16 years ago
@Bruno: This related ticket might also be of interest to you: http://ports.haiku-files.org/ticket/70 Perhaps you can point us in the right direction on that one, I tried working around it a few months back but it was over my head. Might be related to #2696 and some of the missing functions?
comment:5 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Replying to scottmc:
@Bruno: This related ticket might also be of interest to you: http://ports.haiku-files.org/ticket/70
This one is already obsolete. fpurge() and freading() have been implemented in Haiku since, and for freadahead() I did at least commit a patch -- though Bruno opted for a different solution.
comment:6 by , 16 years ago
Replying to anevilyak:
Replying to bhaible:
I will address this in the lib/error.c and lib/strerror.c from gnulib. But it would be good if you changed the errno values for POSIX compliance, in the medium term.
That realistically can't be changed at this point without breaking compat with pretty much every existing BeOS app.
Just to be clear: The BeOS API which Haiku inherits (and will keep and extend for the foreseeable future) requires error codes to be negative, so that e.g. a method's negative ssize_t return value does not only indicate that an error occurred, but does directly encode the error code. This concept is consequently used in the BeOS API and we can't change it without breaking pretty much all existing code.
comment:7 by , 16 years ago
The bug is in function private_strerror in haiku/src/bin/diffutils/lib/error.c. gnulib does not contain this code any more. So all that needs to be done to fix this issue, is to upgrade to haiku/src/bin/diffutils/ source code.
screenshot