Menu

#21 dos2unix breaks with exit 0

v1.0_(example)
closed-fixed
None
5
2026-04-07
2025-08-15
No

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.

1 Attachments

Discussion

  • Erwin Waterlander

     
  • Erwin Waterlander

    Hi Joao,

    Thank for reporting the issue. I will soon have a look at this.

    kind regards,

    Erwin

     
  • Erwin Waterlander

    Patch uploaded
    [0820f7]

     

    Related

    Commit: [0820f7]

  • Erwin Waterlander

    Fix is available in the new 7.5.3 release.

     
  • Erwin Waterlander

    • status: open --> closed-fixed
     
  • Richard W.M. Jones

    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?

     
  • Erwin Waterlander

    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.

     
  • Erwin Waterlander

    • status: closed-fixed --> open
     
  • Erwin Waterlander

    Hi,

    I created new dos2unix release 7.5.4, which has the old behaviour restored.

    regards,
    Erwin

     
  • Erwin Waterlander

    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]

  • Erwin Waterlander

    I just released dos2unix 7.5.5 with the new option.

     
  • Erwin Waterlander

    • status: open --> closed-fixed
     

Anonymous
Anonymous

Add attachments
Cancel





Monday.com Logo