Package: sed
Version: 4.1.2-8
Severity: normal

Hello,

If I use sed -i to attempt to operate on a symlink in place, sed breaks
the symlink and creates a new file.  I believe it should instead follow the
symlink and edit the target file in place.  After all, the man page
says:

       -i[SUFFIX], --in-place[=SUFFIX]

                edit files in place (makes backup if extension supplied)
                           ^^^^^^^^

This is what currently happens:

benjo[16]:~% echo foo > a
benjo[17]:~% ln -s a b
benjo[18]:~% sed -i s/foo/bar/ b
benjo[19]:~% ls -l a b
-rw-r--r--  1 kmccarty kmccarty 4 2005-08-18 16:33 a
-rw-r--r--  1 kmccarty kmccarty 4 2005-08-18 16:33 b
benjo[20]:~% cat a b
foo
bar

In my opinion the correct output after the sed command should be as
follows:

benjo[19]:~% ls -l a b
-rw-r--r--  1 kmccarty kmccarty 4 2005-08-18 16:33 a
lrwxrwxrwx  1 kmccarty kmccarty 4 2005-08-18 16:33 b -> a
benjo[20]:~% cat a b
bar
bar


-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.8-2-386
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages sed depends on:
ii  libc6                       2.3.2.ds1-22 GNU C Library: Shared libraries an

-- no debconf information

regards,

-- 
Kevin B. McCarty <[EMAIL PROTECTED]>   Physics Department
WWW: http://www.princeton.edu/~kmccarty/    Princeton University
GPG: public key ID 4F83C751                 Princeton, NJ 08544


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to