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]

Reliable old script loses data on new Cygwin installation


Dear all,

I have been using a Korn shell script twenty times per day
for more than ten years -- I published an earlier version
in UnixWorld in 1994 and the latest version last year in
lifehacker.com [1].

When I now run the script on brand-new Cygwin installations,
it loses data.  I have tested the script on fresh data many
times and find that it may run correctly twenty times and
then fail.  Then it will run correctly ten more times and fail,
but at a different point in processing the data.

The line of the script that is causing the failure is:

	gawk '$'$Searchfield' !~ /'$Searchkey'/' $3 >|$Tmpfile; mv $Tmpfile $3

(it gets STDOUT from a previous line), where:

    Tmpdir=/tmp             
    Tmpfile=$Tmpdir/shf$$.tmp    (i.e., /tmp/shf2080.tmp)

i.e.:

	gawk '$1 !~ /^LINX/ $3' >|/tmp/sht2080.tmp; mv /tmp/sht2080.tmp huh2

What I get is error messages like the following:

    mv: cannot create regular file `huh2': Permission denied
    gawk: cmd. line:1: fatal: cannot open file `huh2' for reading (No such file or directory)
    gawk: cmd. line:1: fatal: cannot open file `huh2' for reading (No such file or directory)

What I then find is that data has been lost.  If I interrupt
the script right after the error message I find files 
(such as "huh2") that have a length of zero -- OR I find a file
listed with a correct-looking length but garbage contents.
For example, the text file (before running the script):

    - 2007-10-28  20:25       4010  german        

comes out the other end looking like

    - 2007-10-28  20:31       4010  german        

but "od german" shows the _entire_ contents of the file to be:

    0000000 000000 000000 000000 000000 000000 000000 000000 000000
    *
    0007640 000000 000000 000000 000000 000000
    0007652

I have used this script on many machines and platforms over
the years (Linux, Solaris, DOS 3.3 with MKS Toolkit, Win95,
Win2000, XP).  It is now failing on two different WinXP
computers on which I have just installed Cygwin from the Web.
-- one brand-new (with an English-language XP and a SATA hard
disk) and one two years old (with a German-language-XP and
an ATA hard disk).

One of the machines with the new Cygwin installation also lost
lots of data when I scheduled it to move a large subdirectory
(using "mv") in the middle of the night.  The message I found
on my return was:

   "Windows - Device TimeOut"
   The specified I/O operation on \Device\Harddisk7\DR10 was not completed before the 
   time-out period expired.

Comparing the packages installed on my laptop (which has no
problems with "mv") with the packages on the two computers
with the new Cygwin installation, I see:

            Older (works)     Newer installation (broken)
coreutils   6.4-1             6.9-5
gawk        3.1.5-4           3.1.6-1
pdksh       5.2.14-3          5.2.14-3

The two computers on which I am getting errors have the
following in common:

-- Their processors and hard disks are faster than *most*
   of the computers I have been using (both are generic
   home-office PCs from Siemens-Fujitsu).

-- Both now have the latest version of Cygwin from the Web.

I have searched FAQs and mailing lists for problems with
"timeout" and the like but find nothing obviously relevant.
A colleague of mine who knows alot more about these things is
scratching his head on this.  Is it possible that something
in the more recent versions of Cygwin packages is causing
this problem?

Many thanks,
Tom Baker

[1] http://lifehacker.com/software/command-line/getting-things-done-with-rulebased-list-processing-217063.php



-- 
Tom Baker - tbaker@tbaker.de - baker@sub.uni-goettingen.de

--
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]