- Package:
- debianutils
- Source:
- debianutils
- Description:
- Miscellaneous utilities specific to Debian
- Submitter:
- Brian May
- Date:
- 2023-11-25 12:27:06 UTC
- Severity:
- wishlist
Hello, By Changing: ln -f "$filename" "$newname.0" mv "$filename.new" "$filename" To: mv "$filename" "$newname.0" mv "$filename.new" "$filename" in /usr/bin/savelog: - IMHO it is simpler; - it works on NFS root systems where NFS file locking has been enabled. (previously, it would complain when attempting to overwrite $filename on the second line, as this file was still open by syslog). Comments?
reassign 25228 debianutils thanks In article <19980731044755.6896.qmail@snoopy.apana.org.au> you write: $ dpkg -S /usr/bin/savelog debianutils: /usr/bin/savelog Wrong package. I'm reassigning this bug to debianutils. Mike.
No, that would cause any logging information written between the time this runs and the time the daemon starts writing to the new log file to be lost. The current way, the daemon will just continue to write information out to the file.0 name. I could change the second line to `mv -f' though. Would that solve your problem? Guy
Guy Maor wrote:
I am confused... If you move $filename to $newname.0, the new
filename will share the same inode entry, and active
prcesses should still continue writing to $newname.0
?????????????
Please correct me if I am wrong, but I believe
that the following excerpts are the same (only the top version doesn't
work with file locking):
1:----------------------------
ln -f "$filename" "$newname.0"
mv "$filename.new" "$filename" <--- This line crashes with file locking
2:----------------------------
ln -f "$filename" "$newname.0"
rm "$filename"
mv "$filename.new" "$filename" <--- This works as "$filename" doesn't exist
3:----------------------------
mv "$filename" "$newname.0"
mv "$filename.new" "$filename" <--- Same here
In fact, mv (instead on) ln -f is already used if "$filenew" is
not defined:
# link the file into the file.0 holding place
if [ -f "$filename" ]; then
if [ -n "$filenew" ]; then
# ln -f "$filename" "$newname.0" (OLD LINE)
mv "$filename" "$newname.0"
mv "$filename.new" "$filename"
else
mv "$filename" "$newname.0"
fi
fi
touch "$newname.0"
fixfile "$newname.0"
I'll admit that their might be side effects that I haven't considered, but I
don't see how this could be one of them.
No. The problem would still occur (I think the error comes from the
kernel).
Brian May <bam@snoopy.apana.org.au>
Brian May <bam@snoopy.apana.org.au> writes: Yes, you're write. I don't know what I was thinking. Guy
Guy Maor wrote: You were probably thinking of a process that _starts_ logging to that filename, after the first mv and before the second mv. It might create a new log file, which will then be unlinked by the second mv and the process will end up logging to an unlinked file. Richard Braakman
Richard Braakman <dark@xs4all.nl> writes: Yes, so I'll just add an extra rm before the mv as you, Brian, suggested earlier. Guy
I wrote: No, that's wrong too. Now there's a race condition between the rm and the mv. Hmm, I need more coffee. Guy
Guy Maor wrote: That still leaves the same possibility open, between the rm and the mv. I doubt that there is any other way than ln followed by mv to switch log files atomically. (grumble at NFS) Richard Braakman
Richard Braakman wrote: Maybe it could be said that this is a kernel/nfs bug as: mv a b Should be the atomic equivalent to: rm b mv a b (at least I think this is correct). ie it shouldn't complain if b is locked, since rm works even if the file is locked. Comments? Brian May <bam@snoopy.apana.org.au>
BITEXCO 68-FLOOR ICONIC BUILDING FOR SALE IN THE CENTER OF DISTRICT 1, HO CHI MINH CITY, VIETNAM 1. Selling the 68-storey Bitexco Building. Bitexco Financial Building is a tower invested and built by Bitexco Group with an area of nearly 6,100 m² and 68 floors. The project was completed and put into use on October 31, 2010. The building's architecture was inspired by the lotus bud, which is Vietnam's national flower. Bitexco Financial Tower is located at 2 Hai Trieu, Ben Nghe Ward, District 1, Ho Chi Minh City, also known as Bitexco Financial Tower. The 296m high Bitexco Financial Tower was designed by American architect Zapata. The height of the Bitexco building is 269m with 3 basements and 68 floors The building has a total of 12 elevators with a speed of 7m/s Especially on the 49th floor of the building there is the Saigon Skydeck observatory, allowing you to admire the panoramic view of the city and Saigon River from above. In addition, on the 52nd floor there is also a 191m high, 40m long helipad designed outside the main structure of the building. Contact: 0973 341 703 for support