develooper Front page | perl.perl5.porters | Postings from July 2016

Re: [perl #24000] perl -pi -e s:foo:foo2: FILE mishandles symlinks?

From:
Dan Collins
Date:
July 6, 2016 00:14
Subject:
Re: [perl #24000] perl -pi -e s:foo:foo2: FILE mishandles symlinks?
Message ID:
CA+tt54LCeN-a4k5CX9SDtDWXusDwOxGMwK7NyRJeVbs-fcZNfw@mail.gmail.com
Well then, I suppose it is just my expectations that are defective. ;) Is
there a place to document this better, or should we just mark this rejected?

On Tue, Jul 5, 2016 at 7:50 PM, Tony Cook via RT <perlbug-followup@perl.org>
wrote:

> On Tue Jul 05 15:47:08 2016, dcollinsn@gmail.com wrote:
> > Confirmed in blead.
> >
> > I definitely thing this is a bug that needs to be repaired. At
> > minimum, as suggested, I think a warning would be helpful when the
> > target file is a symlink that is not being followed. After all, this
> > is "like sed", as perl -h says. If you're following the link to read
> > the file, you should also follow the link to write it.
>
> According to its documentation, the default for GNU sed is to break the
> symlink:
>
> `--follow-symlinks'
>      This option is available only on platforms that support symbolic
>      links and has an effect only if option `-i' is specified.  In this
>      case, if the file that is specified on the command line is a
>      symbolic link, `sed' will follow the link and edit the ultimate
>      destination of the link.  The default behavior is to break the
>      symbolic link, so that the link destination will not be modified.
>
> which is the behaviour I expected.
>
> (POSIX, BSD, Solaris sed don't seem to support in-place editing.)
>
> My work in progress in-place edit branch doesn't attempt to follow
> symlinks.
>
> Tony
>
> ---
> via perlbug:  queue: perl5 status: open
> https://rt.perl.org/Ticket/Display.html?id=24000
>



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About