On Mon, Sep 01, 2008 at 04:14:21AM +0200, Jan Christoph Nordholz wrote:

Thank you for your prompt reply, Jan.

> > Performing the following steps on the Debian nvi packages 1.79-26 and
> > 1.81.6-3 produces different results.
> 
> that's strange - I can reproduce it with both versions here. 

I just tested three Debian installs, on two different computers, and I
still get different behavior from 1.79* and 1.81.6-3. I've appended
partial output from reportbug --template nvi (1.79*) on each system to
this email.

> I.e., as long as nvi has the file itself open for writing (no matter
> whether that access is exclusive or not) instead of a backup file,
> execve() cannot succeed.

Ok.  Looking closer at the straces I attached to my previous emails, I
found these differences:

  1.81.6-3
  ~~~~~~~~
  221:open("bin/myxplanet", O_RDWR)           = 4
  222:fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0


  1.79-26
  ~~~~~~~
  93:open("bin/myxplanet", O_RDONLY|O_NONBLOCK) = 3
  100:fcntl64(3, F_GETFL)                     = 0x800 (flags 
O_RDONLY|O_NONBLOCK)

1.81 opens the file Read/Write; 1.79 opens it read-only.   That made me
wonder how 1.79 writes. A new strace involving an edit and a :w
shows that 1.79 writes by opening the file again as write-only:

  1.79-26 (Extra)
  ~~~~~~~~~~~~~~~
  open("bin/myxplanet", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 7
  fcntl64(7, F_GETFL)                     = 0x1 (flags O_WRONLY)
  fstat64(7, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
  mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7f99000
  _llseek(7, 0, [0], SEEK_CUR)            = 0
  write(7, "#!/bin/bash -eu\n\n\nENV=~/.xplanet/"..., 1410) = 1410
  fstat64(7, {st_mode=S_IFREG|0755, st_size=1410, ...}) = 0
  fsync(7)                                = 0
  close(7)                                = 0

> The only way around this would be to make a full copy of the original
> file, work on that and atomically copy the changes back on ":w"... but
> I don't remember a nvi version that did that.

It looks like vim uses that method with its .swp files. I think the nvi
developers should either revert to the old dual-open or switch to the
vim temporary file method, but not keep the file open for writing any
longer than need be.

Thanks for your help,

-Dave

-- System Information: (mail.dtrt.org)
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.18.8-linode10 (SMP w/4 CPU cores)
Locale: LANG=en_US.ISO-8859-15, LC_CTYPE=en_US.ISO-8859-15 (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages nvi depends on:
ii  libc6                     2.7-13         GNU C Library: Shared libraries
ii  libncurses5               5.6+20080804-1 shared libraries for terminal hand

-- System Information: (callisto)
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.ISO-8859-15, LC_CTYPE=en_US.ISO-8859-15 (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages nvi depends on:
ii  libc6                     2.7-13         GNU C Library: Shared libraries
ii  libncurses5               5.6+20080804-1 shared libraries for terminal hand


-- System Information: (dragon)
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages nvi depends on:
ii  libc6                     2.7-12         GNU C Library: Shared libraries
ii  libncurses5               5.6+20080621-2 shared libraries for terminal hand



-- 
David A. Harding            Website:  http://dtrt.org/
1 (609) 997-0765              Email:  [EMAIL PROTECTED]
                        Jabber/XMPP:  [EMAIL PROTECTED]



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

Reply via email to