SUSE Support

Here When You Need Us

dos2unix fails between filesystems

This document (7003392) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10 Service Pack 2

Situation

When dos2unix is run in a different directory than the target directory and across filesystems, the command fails. If the input file and output file is the same file/filename, the original, input file gets corrupted.

Symptoms:

The dosfile is in the directory /mnt (filesystem: reiserfs) and the target directory is /tmp (filesystem: ext3), dos2unix fails converting the file:

hostname: ~ # cd /mnt/
hostname:/mnt # dos2unix -n /mnt/dosfile /tmp/unixfile
dos2unix: converting file /mnt/dosfile to file /tmp/unixfile in UNIX format ...
dos2unix: problems renaming './d2utmpll5EdT' to '/tmp/unixfile'
          output file remains in './d2utmpll5EdT'
dos2unix: problems converting file /mnt/dosfile to file /tmp/unixfile

Change into the target directory /tmp and run dos2unix again, this time the file is converted:

hostname:/mnt # cd /tmp/
hostname:/tmp # dos2unix -n /mnt/dosfile /tmp/unixfile
dos2unix: converting file /mnt/dosfile to file /tmp/unixfile in UNIX format ...

The reason is that the output is generated first as temporary file in the current directory ('./d2utmpll5EdT') and then via rename, moved to the target directory, and rename() fails, because it does not support moves between filesystems.

Resolution

Use dos2unix on the same filesystem or run dos2unix in the target directory.

For SUSE Linux Enterprise Server 11 a patch resolving the problem is available.
Install the dos2unix update, dos2unix -3.1-438.22.1.
The dos2unix version in SUSE Linux Enterprise Server SP3 also corrects the problem.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7003392
  • Creation Date: 28-May-2009
  • Modified Date:28-Sep-2022
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.