On 20/06/2019 22.29, Dave Howorth wrote:
On Thu, 20 Jun 2019 22:26:02 +0200 "Carlos E. R." <robin.listas@telefonica.net> wrote:
On 20/06/2019 21.14, Dave Howorth wrote:
On Thu, 20 Jun 2019 18:50:03 +0200 "Carlos E. R." <robin.listas@telefonica.net> wrote:
On 20/06/2019 18.14, Dave Howorth wrote:
On Thu, 20 Jun 2019 17:55:53 +0200 Mathias Homann <Mathias.Homann@opensuse.org> wrote:
It's editor related - happens to me too, my $EDITOR and $VISUAL point at /usr/bin/joe
Yup.
$ sudo EDITOR=/usr/bin/jstar systemctl edit --system apache2 $ ls -la /etc/systemd/system/apache2.service.d/ total 8 drwxr-xr-x 1 root root 90 Jun 20 17:12 ./ drwxr-xr-x 1 root root 1622 Jun 20 15:31 ../ -rw-r--r-- 1 root root 27 Jun 20 17:12 override.conf -rw-r--r-- 1 root root 10 Jun 20 15:31 .#override.conf3934306d53707dd5~
So not new but definitely editor-related
Try another editor that creates backups. The problem will be there.
I already told you it wasn't; here's the proof:
$ sudo EDITOR=/usr/bin/vim systemctl edit --system apache2 $ ls -la /etc/systemd/system/apache2.service.d/ total 4 drwxr-xr-x 1 root root 26 Jun 20 20:02 ./ drwxr-xr-x 1 root root 1622 Jun 20 20:02 ../ -rw-r--r-- 1 root root 10 Jun 20 20:02 override.conf
and yes it was editing ...service.d/.#override.confb43e88ab28a12419
-rw-r--r-- 1 root root 10 Jun 20 20:02 .#override.confb43e88ab28a12419 -rw-r--r-- 1 root root 12288 Jun 20 20:03 .#override.confb43e88ab28a12419.swp
There are three solutions:
You missed out the obvious solution:
create the temporary file in place in the final directory (which serves to check that the directory is now present with adequate permissions) then rename it to the final name upon exit.
create the temporary file on a temporary directory, such as /tmp, edit then move to final destination. This is what what crontab does.
but there's no temporary file left in tmp when vim edits a crontab, just as there's no temporary file in the override directory when vim edits a service file
Make the call to the EDITOR in some manner that disables backups - but this will affect any other use of EDITOR by other calls.
Disable edit file backup altogether in joe - again, this affects other jobs.
The first one I think is better, and that lands it at systemd table.
The left over file is only present when you use jstar, not any other editor. So how is this systemd's fault?
I repeat: try any other editor that creates backup files by default.
You mean like vim does?
No, like joe does. Vim doesn't. cer@Telcontar:~/tmp/vim> l total 12 drwxr-xr-x 2 cer users 6 Jun 20 22:38 ./ drwxr-xr-x 113 cer users 8192 Jun 20 22:38 ../ cer@Telcontar:~/tmp/vim> vim cer@Telcontar:~/tmp/vim> vim p cer@Telcontar:~/tmp/vim> l total 16 drwxr-xr-x 2 cer users 15 Jun 20 22:39 ./ drwxr-xr-x 113 cer users 8192 Jun 20 22:38 ../ -rw-r--r-- 1 cer users 7 Jun 20 22:39 p cer@Telcontar:~/tmp/vim> vim p cer@Telcontar:~/tmp/vim> l total 16 drwxr-xr-x 2 cer users 15 Jun 20 22:39 ./ drwxr-xr-x 113 cer users 8192 Jun 20 22:38 ../ -rw-r--r-- 1 cer users 8 Jun 20 22:39 p cer@Telcontar:~/tmp/vim> See? vim doesn't. No p.bak file. -- Cheers / Saludos, Carlos E. R. (from 15.0 x86_64 at Telcontar)