Bug 929 - sudoedit leaves temporary files in /var/tmp
sudoedit leaves temporary files in /var/tmp
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.9.0
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-06-14 10:00 MDT by infmagic2047reg
Modified: 2020-06-19 05:59 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description infmagic2047reg 2020-06-14 10:00:42 MDT
Steps to reproduce:

1. Use sudoedit to edit a file, like "sudoedit foo".
2. Edit the file in the editor, save and exit.
3. A temporary file named like "foo.XXvWEXok" will be left in /var/tmp.

This bug only occurs if the file is modified by the editor, that is, if sudoedit thinks the file is changed.

This bug does not occur with 1.8.31.

I believe this bug occurs because in 1.9.0, sudo_edit.c's sudo_edit_copy_tfiles() no longer unlinks the temporary file after a success operation, so the temporary file will not be removed. The same function in 1.8.31 does have an unlink() call after success.
Comment 1 Todd C. Miller 2020-06-14 16:41:23 MDT
Thanks for reporting this.  It is fixed by https://www.sudo.ws/repos/sudo/rev/2bc4822b7382 which will be in sudo 1.9.1.
Comment 2 Todd C. Miller 2020-06-19 05:59:51 MDT
Fixed in sudo 1.9.1