This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Weird "input file is output file" error from cat


(This seen after installing cygwin-inst-20040322.tar on top of 1.5.9 on
Windows 2K3 Server.)

It seems that in some directories, cat (from textutils-2.0.21-1) produces a
strange error:

/z/work/client/objects/nt/app-dbg-int-ram> touch a b c; cat a b > c

/z/work/client/objects/nt/app-dbg-int-ram> cd result/

/z/work/client/objects/nt/app-dbg-int-ram/result> touch a b c; cat a b > c
cat: a: input file is output file

/z/work/client/objects/nt/app-dbg-int-ram/result> ls -li a b c
8385220929766002848 -rw-r--r--    1 josb     mkpasswd        0 Mar 24 11:37 a
8385220929766002849 -rw-r--r--    1 josb     mkpasswd        0 Mar 24 11:37 b
8385220929766002850 -rw-r--r--    1 josb     mkpasswd        0 Mar 24 11:36 c

/z/work/client/objects/nt/app-dbg-int-ram/result> cd ..

/z/work/client/objects/nt/app-dbg-int-ram> ls -li a b c
12036222075236473315 -rw-r--r--    1 josb     mkpasswd        0 Mar 24 11:36 a
12036222075236473316 -rw-r--r--    1 josb     mkpasswd        0 Mar 24 11:36 b
12036222075236473317 -rw-r--r--    1 josb     mkpasswd        0 Mar 24 11:36 c

Something else that's weird:

/z/work/client/objects/nt/app-dbg-int-ram> cd result

/z/work/client/objects/nt/app-dbg-int-ram/result> cat a b > d
cat: b: input file is output file

/z/work/client/objects/nt/app-dbg-int-ram/result> cat a > d

/z/work/client/objects/nt/app-dbg-int-ram/result>

Note that all these files do not exist before the touch.

The code in cat.c looks like this:

      if (check_redirection
          && stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino
          && (input_desc != STDIN_FILENO))
        {
          error (0, 0, _("%s: input file is output file"), infile);
          exit_status = 1;
          goto contin;
        }

But when I rebuild cat from the textutils-2.0.21-1 sources I don't see the
problem. It almost looks like something is wrong with the cat in the textutils
package.

/bin> cygcheck.exe cat.exe
Found: .\cat.exe
Found: c:\dev\common\cygwin\1.5\bin\cat.exe
cat.exe
  .\cygwin1.dll
    C:\WINNT\system32\ADVAPI32.DLL
      C:\WINNT\system32\KERNEL32.dll
        C:\WINNT\system32\ntdll.dll
      C:\WINNT\system32\RPCRT4.dll
  .\cygintl-1.dll

/bin>

Ideas, anyone?

-- 
Jos Backus                       _/  _/_/_/      Sunnyvale, CA
                                _/  _/   _/
                               _/  _/_/_/
                          _/  _/  _/    _/
jos at catnook.com        _/_/   _/_/_/          require 'std/disclaimer'

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]