Benno Schulenberg wrote...

> Out of curiosity: have you actually run into this?  Or is this just
> from code inspection?

Yes, after code inspection[*]:

$ ps ax | grep nano
403434 ?        S+     0:00 nano /tmp/foo

$ printf '%x\n' $(pidof nano)
627ea

$ hd /tmp/.foo.swp | head -2
00000000  62 30 6e 61 6e 6f 20 32  2e 36 2e 31 00 00 00 00  |b0nano 2.6.1....|
00000010  00 00 00 00 00 00 00 00  ea 27 00 00 63 62 69 65  |.........'..cbie|
                                   ^^ ^^

Or, using bleeding-edge file(1)

$ file /tmp/.foo.swp
/tmp/.foo.swp: Nano swap file, pid 10218, user cbiedl, host <redacted>, file 
/tmp/foo, modified
                                   ^^^^^ ups!

> If you've actually run into this, please try also with vim.  Does it
> display the correct (32-bit) PID?  (Because, as far as I know, this
> lock-file stuff was "copied" from vim.  But if vim does it correctly,
> then it was copied incompletely and it will get fixed.)

vim does things right:

$ ps ax | grep vim
403859 ?        S+     0:00 vim /tmp/foo

$ printf '%x\n' $(pidof vim)
62993

$ hd /tmp/.foo.swp | head -2
00000000  62 30 56 49 4d 20 37 2e  34 00 00 00 00 10 00 00  |b0VIM 7.4.......|
00000010  00 00 00 00 00 00 00 00  93 29 06 00 63 62 69 65  |.........)..cbie|
                                   ^^ ^^ ^^

$ file /tmp/.foo.swp
/home/cbiedl/.tmp/foo.swp: Vim swap file, version 7.4, pid 403859, user cbiedl, 
host <redacted>, file /tmp/foo, modified

    Christoph

[*] Part of the work for #803219

Attachment: signature.asc
Description: Digital signature

Reply via email to