RE: Mv after tar in a shell script problems

2005-05-18 Thread Gary R. Van Sickle
 Am I losing my mind, or shouldn't this just work(tm) in a 
 shell script?:
 
  #!/bin/sh
  # ^^ behaves the same if it's /bin/bash
 
  tar xvjf file.tar.bz2
  mv dir_name_file.tar.bz2_untars_to new_dir_name
 
 ???
 
 About half the time I get Permission denied from mv, the 
 other half it works fine.  If I do it by hand, even after a 
 Permission denied, it works fine.  This is with both the 
 current DLL snapshot and 1.5.16-1, current coreutils.  I must 
 be missing something pretty basic here, because configures 
 etc are working fine.
 

...and, if I change the mv to a loop which keeps trying if there's a
failure:

  while ! mv dir_name_file.tar.bz2_untars_to new_dir_name; do echo retrying
move...; done

it will eventually work after a few iterations.

I... huh?

I'll brew up a test case, this is nutso.

-- 
Gary R. Van Sickle
 


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



Re: Mv after tar in a shell script problems

2005-05-18 Thread Brian Dessent
Gary R. Van Sickle wrote:

 ...and, if I change the mv to a loop which keeps trying if there's a
 failure:
 
   while ! mv dir_name_file.tar.bz2_untars_to new_dir_name; do echo retrying
 move...; done
 
 it will eventually work after a few iterations.
 
 I... huh?
 
 I'll brew up a test case, this is nutso.

The only thing I can think of is that tar exits immediately after
issuing the final write() of the last file, and mv starts up before the
file system has a chance to finish commiting that write to disk.

The question would then be, does the filesystem allow close() to
complete even if there is still outstanding IO.  Maybe it has to do with
write caching of the drive.

Brian

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



RE: Mv after tar in a shell script problems

2005-05-18 Thread Gary R. Van Sickle
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Brian Dessent
 Sent: Wednesday, May 18, 2005 4:31 AM
 To: cygwin@cygwin.com
 Subject: Re: Mv after tar in a shell script problems
 
 Gary R. Van Sickle wrote:
 
  ...and, if I change the mv to a loop which keeps trying if there's a
  failure:
  
while ! mv dir_name_file.tar.bz2_untars_to new_dir_name; do echo 
  retrying move...; done
  
  it will eventually work after a few iterations.
  
  I... huh?
  
  I'll brew up a test case, this is nutso.
 
 The only thing I can think of is that tar exits immediately 
 after issuing the final write() of the last file, and mv 
 starts up before the file system has a chance to finish 
 commiting that write to disk.
 

That's almost what it's acting like.  Well, sort of [see next].

 The question would then be, does the filesystem allow close() 
 to complete even if there is still outstanding IO.  Maybe it 
 has to do with write caching of the drive.

None of that should matter.  Once a file is close()ed (and certainly once
the close()ing program has terminated!), it's committed to the filesystem.
Where the filesystem puts the actual data and when is of no concern at the
open()/close() level.  In fact I'm certain the filesystem (whether NTFS or
FAT) *does* return from CloseHandle() potentially before anything gets
written to the physical medium.  But the filesystem knows (or should know)
about any files pending writing and act accordingly, i.e. allow the same
access to them as any other file, perhaps by blocking until it gets written
or whatever.

Unless tar is doing something like untarring to a temp directory and then
doing a shell-api move that it doesn't wait for.  I don't know.  I'll get a
test case together and... well, I'm sure then the problem will mysteriously
vanish. ;-)

-- 
Gary R. Van Sickle


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



Re: Mv after tar in a shell script problems

2005-05-18 Thread Corinna Vinschen
On May 18 02:30, Brian Dessent wrote:
 Gary R. Van Sickle wrote:
 
  ...and, if I change the mv to a loop which keeps trying if there's a
  failure:
  
while ! mv dir_name_file.tar.bz2_untars_to new_dir_name; do echo retrying
  move...; done
  
  it will eventually work after a few iterations.
  
  I... huh?
  
  I'll brew up a test case, this is nutso.
 
 The only thing I can think of is that tar exits immediately after
 issuing the final write() of the last file, and mv starts up before the
 file system has a chance to finish commiting that write to disk.

Sounds not convincing.  If the OS isn't able to deal with such a basic
situation, it's seriously unusable.  Windows might have some annoying
properties, but it's certainly usable.


I'm just running a script which desperatly tries to reproduce the above
problem, but it WJFFM:

  #!/bin/sh
  while true
  do
tar xvjf foo.tar.bz2
mv foo.dir bar.dir
rm bar.dir
  done


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  mailto:cygwin@cygwin.com
Red Hat, Inc.

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



Re: Mv after tar in a shell script problems

2005-05-18 Thread Corinna Vinschen
On May 18 04:57, Gary R. Van Sickle wrote:
 Unless tar is doing something like untarring to a temp directory and then
 doing a shell-api move that it doesn't wait for.  I don't know.  I'll get a
 test case together and... well, I'm sure then the problem will mysteriously
 vanish. ;-)

What about using strace or, better, gdb?  Does it even occur under strace?
As I said, WJFFM for hundreds of iterations.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  mailto:cygwin@cygwin.com
Red Hat, Inc.

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



Re: Mv after tar in a shell script problems

2005-05-18 Thread Brian Dessent
Corinna Vinschen wrote:

 Sounds not convincing.  If the OS isn't able to deal with such a basic
 situation, it's seriously unusable.  Windows might have some annoying
 properties, but it's certainly usable.
 
 I'm just running a script which desperatly tries to reproduce the above
 problem, but it WJFFM:

It just occured to me that some antivirus-type programs hook into file
IO calls.  Perhaps such a program is being invoked to scan the file
after it is created and keeps it open for that brief instant long enough
for mv to try to move it.

Brian

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



RE: Mv after tar in a shell script problems

2005-05-18 Thread Gary R. Van Sickle
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Corinna Vinschen
 Sent: Wednesday, May 18, 2005 5:01 AM
 To: cygwin@cygwin.com
 Subject: Re: Mv after tar in a shell script problems
 
 On May 18 04:57, Gary R. Van Sickle wrote:
  Unless tar is doing something like untarring to a temp 
 directory and 
  then doing a shell-api move that it doesn't wait for.  I 
 don't know.  
  I'll get a test case together and... well, I'm sure then 
 the problem 
  will mysteriously vanish. ;-)
 
 What about using strace or, better, gdb?  Does it even occur 
 under strace?
 As I said, WJFFM for hundreds of iterations.
 
 
 Corinna
 

Oh wait waitwaitwaitwaitwait... What this looks more like is my old nemesis
- The Nosy Virus Scanner!  Lessee here... Yep, still doing it, let's check
if... ACTIVESHIELD HAS TURNED ITSELF ON AGAIN...

...only, disabling it and even rebooting don't change anything, I still get
Permission Denieds.  Gat dang, and I was just itching to put McAff... er,
I mean, a certain virus scanner manufacturer... back at the top of The List
;-).

Well, I'm going to bed.  Maybe this will all turn out to be a bad dream...
;-)

-- 
Gary R. Van Sickle



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



Re: Mv after tar in a shell script problems

2005-05-18 Thread Brian Dessent
Gary R. Van Sickle wrote:

 ...only, disabling it and even rebooting don't change anything, I still get
 Permission Denieds.  Gat dang, and I was just itching to put McAff... er,
 I mean, a certain virus scanner manufacturer... back at the top of The List

I don't know if it matters in this case but a lot of firewall/AV type
software doesn't actually unload itself when you disable it.  Some more
notorious software you must uninstall entirely... (cue the Dave K I
hate Norton montage)

Brian

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



Re: Mv after tar in a shell script problems

2005-05-18 Thread Corinna Vinschen
On May 18 05:45, Gary R. Van Sickle wrote:
  What about using strace or, better, gdb?  Does it even occur 
  under strace?
  As I said, WJFFM for hundreds of iterations.
  
  Corinna
 
 Oh wait waitwaitwaitwaitwait... What this looks more like is my old nemesis
 - The Nosy Virus Scanner!  Lessee here... Yep, still doing it, let's check
 if... ACTIVESHIELD HAS TURNED ITSELF ON AGAIN...
 
 ...only, disabling it and even rebooting don't change anything, I still get
 Permission Denieds.  Gat dang, and I was just itching to put McAff... er,
 I mean, a certain virus scanner manufacturer... back at the top of The List
 ;-).
 
 Well, I'm going to bed.  Maybe this will all turn out to be a bad dream...
 ;-)

That's fine.  When you're back from sleep you can still use strace and
gdb.  That's nice with debuggers.  They still work an another day ;-)


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  mailto:cygwin@cygwin.com
Red Hat, Inc.

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



RE: Mv after tar in a shell script problems

2005-05-18 Thread Robb, Sam
 Oh wait waitwaitwaitwaitwait... What this looks more like is 
 my old nemesis
 - The Nosy Virus Scanner!  Lessee here... Yep, still doing 
 it, let's check
 if... ACTIVESHIELD HAS TURNED ITSELF ON AGAIN...
 
 ...only, disabling it and even rebooting don't change 
 anything, I still get
 Permission Denieds.  Gat dang, and I was just itching to 
 put McAff... er,
 I mean, a certain virus scanner manufacturer... back at the 
 top of The List
 ;-).

Hey Gary,

  Are you running Google Desktop Search, or anything else that
might do automatic indexing of newly created files?  These days,
there's a whole lot more than just antivirus out there that
wants to spend a little quality time with every file created
on your system...

-Samrobb

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



RE: Mv after tar in a shell script problems

2005-05-18 Thread Gary R. Van Sickle
  Oh wait waitwaitwaitwaitwait... What this looks more like is my old 
  nemesis
  - The Nosy Virus Scanner!  Lessee here... Yep, still doing 
 it, let's 
  check if... ACTIVESHIELD HAS TURNED ITSELF ON AGAIN...
  
  ...only, disabling it and even rebooting don't change anything, I 
  still get Permission Denieds.  Gat dang, and I was just 
 itching to 
  put McAff... er, I mean, a certain virus scanner 
 manufacturer... back 
  at the top of The List ;-).
 
 Hey Gary,
 
   Are you running Google Desktop Search, or anything else 
 that might do automatic indexing of newly created files?  
 These days, there's a whole lot more than just antivirus out 
 there that wants to spend a little quality time with every 
 file created on your system...
 
 -Samrobb
 

long silence

Son.  Of.  A.  @[EMAIL PROTECTED]@^%  Yes, yes I am running Google Desktop 
Search.
Yes, yes disabling it appears to solve the problem.

Thank you Mr. Robb, I owe you a Coke.  And now, if the Gentle Reader will
allow me, I would like to take this opportunity to rant_on:

It is the twenty first gat dang century and our OSes still are unable to
manage a simple file system properly.  Un.  Be.  Lievable.  I've been
overestimating the state of the CS art in the wild these days as rubbing
sticks together and seeing fire.  In fact, it's closer to rubbing sticks
together, seeing fire, trying to grab the fire, getting burned, lather,
rinse, repeat.  With this sorry state of affairs, it is amply clear that
there is no way these PCs as they're called are ever going to catch on.

/rant_off

Ladies and Gentlemen, you can now expect a new mutt release shortly.

-- 
Gary R. Van Sickle
 


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