dos2unix breaks with exit 0
Dos2Unix / Unix2Dos - Text file format converters
Brought to you by:
waterlan
Dear Erwin,
dos2unix is aborting an operation with exit 0 (success). See the commands below that use the attached file:
$ ./dos2unix oui.20250515.msdos.txt
dos2unix: Binary symbol 0x01 found at line 226939
dos2unix: Skipping binary file oui.20250515.msdos.txt
$ echo $?
0
The problematic line in oui.20250515.msdos.txt is:
P.O^ABox^A17985^AJebel^AAli
The exit should be 1 to avoid any scripts keeping processing after a dos2unix error. I tested this behavior with dos2unix 7.4.1, 7.5.2 and 7.5.3-beta8.
Thanks for your attention.
Anonymous
Hi Joao,
Thank for reporting the issue. I will soon have a look at this.
kind regards,
Erwin
Patch uploaded
[0820f7]
Related
Commit: [0820f7]
Fix is available in the new 7.5.3 release.
This broke a bunch of mingw packages: https://bugzilla.redhat.com/show_bug.cgi?id=2434821#c4
I don't believe this was actually a bug, but nevertheless could we have a flag to restore the previous behaviour?
Hi Richard,
In default mode dos2unix skips binary files (see manual). So it is documented behavior and not a conversion abort due to an error. I agree with you that it was actually not a bug.
First I will revert the 'fix' and create a new dos2unix version soon to get the old behavior back.
I also understand that some people want to see an error if they hit a binary file. I will address this in a later version with a new flag. This requires a documentation update and new translations and so on, so it will take more time.
Hi,
I created new dos2unix release 7.5.4, which has the old behaviour restored.
regards,
Erwin
Uploaded patch [45b342].
New option --error-binary: Return an error if a binary file is skipped.
A beta version with this patch is available at https://waterlan.home.xs4all.nl/dos2unix.html
Related
Commit: [45b342]
I just released dos2unix 7.5.5 with the new option.