#25228 savelog: Please make it work on locked NFS partitions

Package:
debianutils
Source:
debianutils
Description:
Miscellaneous utilities specific to Debian
Submitter:
Brian May
Date:
2023-11-25 12:27:06 UTC
Severity:
wishlist
#25228#5
Date:
1998-07-31 04:47:55 UTC
From:
To:
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?

#25228#10
Date:
1998-07-31 15:24:54 UTC
From:
To:
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.

#25228#17
Date:
1998-08-01 20:47:32 UTC
From:
To:
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

#25228#22
Date:
1998-08-02 02:29:21 UTC
From:
To:
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>

#25228#27
Date:
1998-08-02 03:16:23 UTC
From:
To:
Brian May <bam@snoopy.apana.org.au> writes:

Yes, you're write.  I don't know what I was thinking.


Guy

#25228#32
Date:
1998-08-02 17:29:54 UTC
From:
To:
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

#25228#37
Date:
1998-08-02 19:05:14 UTC
From:
To:
Richard Braakman <dark@xs4all.nl> writes:

Yes, so I'll just add an extra rm before the mv as you, Brian,
suggested earlier.


Guy

#25228#42
Date:
1998-08-02 19:35:05 UTC
From:
To:
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

#25228#47
Date:
1998-08-02 21:09:25 UTC
From:
To:
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

#25228#52
Date:
1998-08-04 07:54:34 UTC
From:
To:
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>

#25228#61
Date:
2023-11-25 12:22:57 UTC
From:
To:
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