perl -i switch bug on cygwin

2002-02-06 Thread Benoit Rochefort

Hi!

It seems there is a bug on the -i switch for perl.
I do not know if it's a perl issue or cygwin issue so I post it here for
first; let me know please if it would be better to send a bug report to
perl mainteners instead.

Here is a small example:

###
gcm [0][GEN13]~mkdir tmp
gcm [0][GEN13]~cd tmp
/home/benoitr/tmp
gcm [0][GEN13]~/tmpecho hello  hello
gcm [0][GEN13]~/tmpls -al
total 5
drwxr-xr-x2 benoitr  None0 Feb  6 11:35 ./
drwxr-xr-x5 benoitr  None 4096 Feb  6 11:34 ../
-rw-r--r--1 benoitr  None6 Feb  6 11:35 hello
gcm [0][GEN13]~/tmpperl -p -i -e 1 hello
Can't do inplace edit on hello: Permission denied.
gcm [0][GEN13]~/tmpls -al
total 4
drwxr-xr-x2 benoitr  None0 Feb  6 11:35 ./
drwxr-xr-x5 benoitr  None 4096 Feb  6 11:34 ../
gcm [0][GEN13]~/tmpecho hello  hello
gcm [0][GEN13]~/tmpperl -p -i~ -e 1 hello
gcm [0][GEN13]~/tmpls -al
total 6
drwxr-xr-x2 benoitr  None0 Feb  6 11:35 ./
drwxr-xr-x5 benoitr  None 4096 Feb  6 11:34 ../
-rw-r--r--1 benoitr  None6 Feb  6 11:35 hello
-rw-r--r--1 benoitr  None6 Feb  6 11:35 hello~
###

As you can see, the -i switch works well with an argument but not at all
with no arguments, which is really inconvenient for me since I have a bunch
of scripts written on UNIX system that rely on this capability (for
substituting texts inplace on a collection of files in conjunction with
find and xargs for example).

I remember that I had this problem one year ago (on cygwin with a modified
version of perl since perl was not on the cygwin standard package at this
time) and fixes it by using the arg form of the -i switch, followed by a rm
of the moved file.

The man perlrun page well describe the desired behavior of the -i
switch with an argument (in fact, the code that should be executed) but
not at all the no arg form of the -i switch. I suppose it should only
unlink the moved file (but is this the way it is done; i.e. moving the
original file with a name not already used in the same directory?).

Oh! Please don't send a workaround, just tell me if it's really a bug or my
misunderstanding of something and what should I do exactly to forward my
observations so that perl/cygwin can be corrected accordingly to the doc.

As a sugar, if the -i switch doc in the man page could exactly describe
the behavior when no arg is given, that would be for sure an enhancement.

Ben

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/




RE: perl -i switch bug on cygwin

2002-02-06 Thread Ralf Habacker

A patch is available in 

http://sources.redhat.com/ml/cygwin-apps/2001-11/msg00736.html


  This has been discussed before.
 http://cygwin.com/ml/cygwin/2001-01/msg5.html   et al
 
  -Original Message-
  From: Benoit Rochefort [mailto:[EMAIL PROTECTED]]
  Subject: perl -i switch bug on cygwin
  It seems there is a bug on the -i switch for perl.
  ...
  As you can see, the -i switch works well with an argument 
  but not at all with no arguments, which is really inconvenient for me
 since 
  ...
  
 
 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Bug reporting: http://cygwin.com/bugs.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/
 
 


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/