Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Is your job running? You'd better go catch it!


devel / comp.unix.programmer / Re: Why is there no write equivalent to *stat() ?

SubjectAuthor
* Why is there no write equivalent to *stat() ?Muttley
`* Re: Why is there no write equivalent to *stat() ?Scott Lurndal
 `* Re: Why is there no write equivalent to *stat() ?Muttley
  `* Re: Why is there no write equivalent to *stat() ?Rainer Weikusat
   +* Re: Why is there no write equivalent to *stat() ?Muttley
   |`* Re: Why is there no write equivalent to *stat() ?Rainer Weikusat
   | `* Re: Why is there no write equivalent to *stat() ?Muttley
   |  `- Re: Why is there no write equivalent to *stat() ?Rainer Weikusat
   `- Re: Why is there no write equivalent to *stat() ?Lew Pitcher

1
Why is there no write equivalent to *stat() ?

<spagg4$1b1f$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16932&group=comp.unix.programmer#16932

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!aioe.org!BKzeqmo2UYxb4eR2zKm0zw.user.46.165.242.91.POSTED!not-for-mail
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.programmer
Subject: Why is there no write equivalent to *stat() ?
Date: Tue, 14 Dec 2021 16:24:36 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <spagg4$1b1f$1@gioia.aioe.org>
Injection-Info: gioia.aioe.org; logging-data="44079"; posting-host="BKzeqmo2UYxb4eR2zKm0zw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Muttley@dastardlyhq.com - Tue, 14 Dec 2021 16:24 UTC

The stat functions are extremely useful in getting file information, yet if
you want to write that information out you need to use a whole menagerie of
different functions. Eg: utime(), chmod(), chown(), chgrp() etc.

Anyone know the historic reasons for this? I'm writing a program which needs
to copy files and give the new files much of the same inode info as the old
ones and its very tedious having to use all the above functions instead of just
re-using the "struct stat" from the stat() call in one pass.

Re: Why is there no write equivalent to *stat() ?

<FE3uJ.108471$lz3.29458@fx34.iad>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16933&group=comp.unix.programmer#16933

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx34.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Why is there no write equivalent to *stat() ?
Newsgroups: comp.unix.programmer
References: <spagg4$1b1f$1@gioia.aioe.org>
Lines: 15
Message-ID: <FE3uJ.108471$lz3.29458@fx34.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 14 Dec 2021 16:30:29 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 14 Dec 2021 16:30:29 GMT
X-Received-Bytes: 1223
 by: Scott Lurndal - Tue, 14 Dec 2021 16:30 UTC

Muttley@dastardlyhq.com writes:
>The stat functions are extremely useful in getting file information, yet if
>you want to write that information out you need to use a whole menagerie of
>different functions. Eg: utime(), chmod(), chown(), chgrp() etc.
>
>Anyone know the historic reasons for this?

Basically, KISS.

Note that there were significant memory limitations in the
1970's - the more the kernel used, the less available for
applications.

And to be fair, it's far more common to need to change only one
attribute at a time.

Re: Why is there no write equivalent to *stat() ?

<spah06$1k80$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16934&group=comp.unix.programmer#16934

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!aioe.org!BKzeqmo2UYxb4eR2zKm0zw.user.46.165.242.91.POSTED!not-for-mail
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.programmer
Subject: Re: Why is there no write equivalent to *stat() ?
Date: Tue, 14 Dec 2021 16:33:10 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <spah06$1k80$1@gioia.aioe.org>
References: <spagg4$1b1f$1@gioia.aioe.org> <FE3uJ.108471$lz3.29458@fx34.iad>
Injection-Info: gioia.aioe.org; logging-data="53504"; posting-host="BKzeqmo2UYxb4eR2zKm0zw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Muttley@dastardlyhq.com - Tue, 14 Dec 2021 16:33 UTC

On Tue, 14 Dec 2021 16:30:29 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:
>Muttley@dastardlyhq.com writes:
>>The stat functions are extremely useful in getting file information, yet if
>>you want to write that information out you need to use a whole menagerie of
>>different functions. Eg: utime(), chmod(), chown(), chgrp() etc.
>>
>>Anyone know the historic reasons for this?
>
>Basically, KISS.
>
>Note that there were significant memory limitations in the
>1970's - the more the kernel used, the less available for
>applications.
>
>And to be fair, it's far more common to need to change only one
>attribute at a time.

Not convinced by that reasoning as you could say the same for reading the
information (you usually only need a small part) yet *stat() was developed.

Re: Why is there no write equivalent to *stat() ?

<877dc7qb3d.fsf@doppelsaurus.mobileactivedefense.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16935&group=comp.unix.programmer#16935

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.programmer
Subject: Re: Why is there no write equivalent to *stat() ?
Date: Tue, 14 Dec 2021 18:45:42 +0000
Lines: 28
Message-ID: <877dc7qb3d.fsf@doppelsaurus.mobileactivedefense.com>
References: <spagg4$1b1f$1@gioia.aioe.org> <FE3uJ.108471$lz3.29458@fx34.iad>
<spah06$1k80$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net kK2f7zpkp9c0+TltImYrngLmkcfpzZAnZumnC0x/gypza+Pis=
Cancel-Lock: sha1:dvtboeViK3l2if8hIyKxHY/wBrw= sha1:zKPrfbTXNDWnJJDMhhLEk4PQFJI=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
 by: Rainer Weikusat - Tue, 14 Dec 2021 18:45 UTC

Muttley@dastardlyhq.com writes:
> On Tue, 14 Dec 2021 16:30:29 GMT
> scott@slp53.sl.home (Scott Lurndal) wrote:
>>Muttley@dastardlyhq.com writes:
>>>The stat functions are extremely useful in getting file information, yet if
>>>you want to write that information out you need to use a whole menagerie of
>>>different functions. Eg: utime(), chmod(), chown(), chgrp() etc.
>>>
>>>Anyone know the historic reasons for this?
>>
>>Basically, KISS.
>>
>>Note that there were significant memory limitations in the
>>1970's - the more the kernel used, the less available for
>>applications.
>>
>>And to be fair, it's far more common to need to change only one
>>attribute at a time.
>
> Not convinced by that reasoning as you could say the same for reading the
> information (you usually only need a small part) yet *stat() was developed.

Stat returns meta-information about files. It easy to and to use by
returning one structure containing all metainformation. But manipulating
all of this information is something different. This would require
something like a multiplexing call taking a bitmask of "change action"
flags and a structure. I'm unaware of the historical reason for this but
IMHO, that's an awful interface design.

Re: Why is there no write equivalent to *stat() ?

<spcbrn$blt$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16936&group=comp.unix.programmer#16936

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!aioe.org!BKzeqmo2UYxb4eR2zKm0zw.user.46.165.242.91.POSTED!not-for-mail
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.programmer
Subject: Re: Why is there no write equivalent to *stat() ?
Date: Wed, 15 Dec 2021 09:17:45 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <spcbrn$blt$1@gioia.aioe.org>
References: <spagg4$1b1f$1@gioia.aioe.org> <FE3uJ.108471$lz3.29458@fx34.iad>
<spah06$1k80$1@gioia.aioe.org>
<877dc7qb3d.fsf@doppelsaurus.mobileactivedefense.com>
Injection-Info: gioia.aioe.org; logging-data="11965"; posting-host="BKzeqmo2UYxb4eR2zKm0zw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Muttley@dastardlyhq.com - Wed, 15 Dec 2021 09:17 UTC

On Tue, 14 Dec 2021 18:45:42 +0000
Rainer Weikusat <rweikusat@talktalk.net> wrote:
>Muttley@dastardlyhq.com writes:
>> On Tue, 14 Dec 2021 16:30:29 GMT
>> scott@slp53.sl.home (Scott Lurndal) wrote:
>>>Muttley@dastardlyhq.com writes:
>>>>The stat functions are extremely useful in getting file information, yet if
>>>>you want to write that information out you need to use a whole menagerie of
>>>>different functions. Eg: utime(), chmod(), chown(), chgrp() etc.
>>>>
>>>>Anyone know the historic reasons for this?
>>>
>>>Basically, KISS.
>>>
>>>Note that there were significant memory limitations in the
>>>1970's - the more the kernel used, the less available for
>>>applications.
>>>
>>>And to be fair, it's far more common to need to change only one
>>>attribute at a time.
>>
>> Not convinced by that reasoning as you could say the same for reading the
>> information (you usually only need a small part) yet *stat() was developed.
>
>Stat returns meta-information about files. It easy to and to use by
>returning one structure containing all metainformation. But manipulating
>all of this information is something different. This would require
>something like a multiplexing call taking a bitmask of "change action"
>flags and a structure. I'm unaware of the historical reason for this but
>IMHO, that's an awful interface design.

I guess we'll have to differ on that. I think it would be very useful in
certain situations, mainly with only having to do 1 system update and hence only
1 check instead of having to do multiple updates and multiple checks with
the file metadata potentially being left in a useless state if any one
of the updates fails (eg chmod() worked but chown() then fails) requiring some
kind of rollback. I'm not saying don't have the individual functions but
complement then with 1 call that updates everything.

Re: Why is there no write equivalent to *stat() ?

<spd66i$kql$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16937&group=comp.unix.programmer#16937

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.unix.programmer
Subject: Re: Why is there no write equivalent to *stat() ?
Date: Wed, 15 Dec 2021 16:47:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <spd66i$kql$1@dont-email.me>
References: <spagg4$1b1f$1@gioia.aioe.org>
<FE3uJ.108471$lz3.29458@fx34.iad> <spah06$1k80$1@gioia.aioe.org>
<877dc7qb3d.fsf@doppelsaurus.mobileactivedefense.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 15 Dec 2021 16:47:14 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ccf8e75afb62554f14aa44b61e51f008";
logging-data="21333"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zwGzHnl2/VfTqvswc/3NFQcYdn3E3mvI="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:hKY2gdaWmkVBCAFDNOggp2hf1Ss=
 by: Lew Pitcher - Wed, 15 Dec 2021 16:47 UTC

On Tue, 14 Dec 2021 18:45:42 +0000, Rainer Weikusat wrote:

> Muttley@dastardlyhq.com writes:
>> On Tue, 14 Dec 2021 16:30:29 GMT scott@slp53.sl.home (Scott Lurndal)
>> wrote:
>>>Muttley@dastardlyhq.com writes:
>>>>The stat functions are extremely useful in getting file information,
>>>>yet if you want to write that information out you need to use a whole
>>>>menagerie of different functions. Eg: utime(), chmod(), chown(),
>>>>chgrp() etc.
>>>>
>>>>Anyone know the historic reasons for this?
>>>
>>>Basically, KISS.
>>>
>>>Note that there were significant memory limitations in the 1970's - the
>>>more the kernel used, the less available for applications.
>>>
>>>And to be fair, it's far more common to need to change only one
>>>attribute at a time.
>>
>> Not convinced by that reasoning as you could say the same for reading
>> the information (you usually only need a small part) yet *stat() was
>> developed.
>
> Stat returns meta-information about files.

Specifically, stat(2) returns a copy of (most of) the raw inode for the
specified file.

> It easy to and to use by
> returning one structure containing all metainformation.

Extremely easy, as all that metainformation sits together in the file's
inode, and the kernel can service the stat(2) call with a simple copy.

> But manipulating all of this information is something different. This
> would require something like a multiplexing call taking a bitmask of
> "change action" flags and a structure.

And, would directly edit a critical resource (the inode). The kernel
would have to sanity check such edits to ensure that the variety of
parameters provided do not conflict with each other, and do not violate
the integrity or security of the filesystem.

> I'm unaware of the historical
> reason for this but IMHO, that's an awful interface design.

If I understand the history correctly, stat(1) came first, as a simple
"dump" of the file inode data. After that, programmers found
"opportunities" to need to make arbitrary changes to the values in the
inode, outside of those syscalls that result in inode changes on their
own (creat(2),open(2), read(2), write(2), close(2), unlink(2), chown(2)
and chmod(2) ).

--
Lew Pitcher
"In Skills, We Trust"

Re: Why is there no write equivalent to *stat() ?

<87v8zpyehe.fsf@doppelsaurus.mobileactivedefense.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16938&group=comp.unix.programmer#16938

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.programmer
Subject: Re: Why is there no write equivalent to *stat() ?
Date: Wed, 15 Dec 2021 17:17:33 +0000
Lines: 46
Message-ID: <87v8zpyehe.fsf@doppelsaurus.mobileactivedefense.com>
References: <spagg4$1b1f$1@gioia.aioe.org> <FE3uJ.108471$lz3.29458@fx34.iad>
<spah06$1k80$1@gioia.aioe.org>
<877dc7qb3d.fsf@doppelsaurus.mobileactivedefense.com>
<spcbrn$blt$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net uaoFWFwOHPYKHTCP2kVAFwPmACTzTl95QFFpWrPmyQR4cNtcU=
Cancel-Lock: sha1:U9u14AFnMhZLP2cxf2ApDcg8I2I= sha1:Xv9NQi9szNkGaVO5JzxhCCw5t2I=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
 by: Rainer Weikusat - Wed, 15 Dec 2021 17:17 UTC

Muttley@dastardlyhq.com writes:
> On Tue, 14 Dec 2021 18:45:42 +0000
> Rainer Weikusat <rweikusat@talktalk.net> wrote:
>>Muttley@dastardlyhq.com writes:
>>> On Tue, 14 Dec 2021 16:30:29 GMT
>>> scott@slp53.sl.home (Scott Lurndal) wrote:
>>>>Muttley@dastardlyhq.com writes:
>>>>>The stat functions are extremely useful in getting file information, yet if
>>>>>you want to write that information out you need to use a whole menagerie of
>>>>>different functions. Eg: utime(), chmod(), chown(), chgrp() etc.
>>>>>
>>>>>Anyone know the historic reasons for this?
>>>>
>>>>Basically, KISS.

[...]

>>> Not convinced by that reasoning as you could say the same for reading the
>>> information (you usually only need a small part) yet *stat() was developed.
>>
>>Stat returns meta-information about files. It easy to and to use by
>>returning one structure containing all metainformation. But manipulating
>>all of this information is something different. This would require
>>something like a multiplexing call taking a bitmask of "change action"
>>flags and a structure. I'm unaware of the historical reason for this but
>>IMHO, that's an awful interface design.
>
> I guess we'll have to differ on that. I think it would be very useful in
> certain situations, mainly with only having to do 1 system update and hence only
> 1 check instead of having to do multiple updates and multiple checks with
> the file metadata potentially being left in a useless state if any one
> of the updates fails (eg chmod() worked but chown() then fails) requiring some
> kind of rollback. I'm not saying don't have the individual functions but
> complement then with 1 call that updates everything.

This would only push the atomic update problem into the kernel. As a
further complication, the system call would probably need to support
update atomicity for any subset of the attributes or even any set of
non-overlapping subsets.

It's also not really difficult to make this appear atomically to other
applications: Start with creating a target file whith some unique,
internal name. Change all attributes supposed to be changed. If
everything succeeded, use link(2) to associate the existing file with the
'real' name it's supposed to have, finally, regardless of success or
failure of the preceding steps, unlink the internal name.

Re: Why is there no write equivalent to *stat() ?

<spd8a2$hj2$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16939&group=comp.unix.programmer#16939

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!aioe.org!BKzeqmo2UYxb4eR2zKm0zw.user.46.165.242.91.POSTED!not-for-mail
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.programmer
Subject: Re: Why is there no write equivalent to *stat() ?
Date: Wed, 15 Dec 2021 17:23:14 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <spd8a2$hj2$1@gioia.aioe.org>
References: <spagg4$1b1f$1@gioia.aioe.org> <FE3uJ.108471$lz3.29458@fx34.iad>
<spah06$1k80$1@gioia.aioe.org>
<877dc7qb3d.fsf@doppelsaurus.mobileactivedefense.com>
<spcbrn$blt$1@gioia.aioe.org>
<87v8zpyehe.fsf@doppelsaurus.mobileactivedefense.com>
Injection-Info: gioia.aioe.org; logging-data="18018"; posting-host="BKzeqmo2UYxb4eR2zKm0zw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Muttley@dastardlyhq.com - Wed, 15 Dec 2021 17:23 UTC

On Wed, 15 Dec 2021 17:17:33 +0000
Rainer Weikusat <rweikusat@talktalk.net> wrote:
>Muttley@dastardlyhq.com writes:
>> On Tue, 14 Dec 2021 18:45:42 +0000
>> Rainer Weikusat <rweikusat@talktalk.net> wrote:
>>>Muttley@dastardlyhq.com writes:
>>>> On Tue, 14 Dec 2021 16:30:29 GMT
>>>> scott@slp53.sl.home (Scott Lurndal) wrote:
>>>>>Muttley@dastardlyhq.com writes:
>>>>>>The stat functions are extremely useful in getting file information, yet
>if
>>>>>>you want to write that information out you need to use a whole menagerie
>of
>>>>>>different functions. Eg: utime(), chmod(), chown(), chgrp() etc.
>>>>>>
>>>>>>Anyone know the historic reasons for this?
>>>>>
>>>>>Basically, KISS.
>
>[...]
>
>>>> Not convinced by that reasoning as you could say the same for reading the
>>>> information (you usually only need a small part) yet *stat() was developed.
>
>>>
>>>Stat returns meta-information about files. It easy to and to use by
>>>returning one structure containing all metainformation. But manipulating
>>>all of this information is something different. This would require
>>>something like a multiplexing call taking a bitmask of "change action"
>>>flags and a structure. I'm unaware of the historical reason for this but
>>>IMHO, that's an awful interface design.
>>
>> I guess we'll have to differ on that. I think it would be very useful in
>> certain situations, mainly with only having to do 1 system update and hence
>only
>> 1 check instead of having to do multiple updates and multiple checks with
>> the file metadata potentially being left in a useless state if any one
>> of the updates fails (eg chmod() worked but chown() then fails) requiring
>some
>> kind of rollback. I'm not saying don't have the individual functions but
>> complement then with 1 call that updates everything.
>
>This would only push the atomic update problem into the kernel. As a

As as userspace dev thats exactly where I want it.

>further complication, the system call would probably need to support
>update atomicity for any subset of the attributes or even any set of
>non-overlapping subsets.
>
>It's also not really difficult to make this appear atomically to other
>applications: Start with creating a target file whith some unique,

Surely most (all) kernels have some kind of filesystem lock on inodes
preventing 2 or more processes updating them simultaniously otherwise you could
end up with serious corruption.

Re: Why is there no write equivalent to *stat() ?

<87lf0litdw.fsf@doppelsaurus.mobileactivedefense.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16940&group=comp.unix.programmer#16940

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.programmer
Subject: Re: Why is there no write equivalent to *stat() ?
Date: Wed, 15 Dec 2021 19:02:19 +0000
Lines: 46
Message-ID: <87lf0litdw.fsf@doppelsaurus.mobileactivedefense.com>
References: <spagg4$1b1f$1@gioia.aioe.org> <FE3uJ.108471$lz3.29458@fx34.iad>
<spah06$1k80$1@gioia.aioe.org>
<877dc7qb3d.fsf@doppelsaurus.mobileactivedefense.com>
<spcbrn$blt$1@gioia.aioe.org>
<87v8zpyehe.fsf@doppelsaurus.mobileactivedefense.com>
<spd8a2$hj2$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net y22q6qb6ULQQnPoqFNUEMATKQL1DbAw6nUo0mR4ynGIiA8wwo=
Cancel-Lock: sha1:b+OYWeX5AZTHzLbdoTjoQlPV1iE= sha1:cJkMv1vhmTRSaXP0XflHsUJDkHk=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
 by: Rainer Weikusat - Wed, 15 Dec 2021 19:02 UTC

Muttley@dastardlyhq.com writes:
> On Wed, 15 Dec 2021 17:17:33 +0000
> Rainer Weikusat <rweikusat@talktalk.net> wrote:
>>Muttley@dastardlyhq.com writes:
>>> On Tue, 14 Dec 2021 18:45:42 +0000
>>> Rainer Weikusat <rweikusat@talktalk.net> wrote:

[...]

>>> 1 check instead of having to do multiple updates and multiple checks with
>>> the file metadata potentially being left in a useless state if any one
>>> of the updates fails (eg chmod() worked but chown() then fails) requiring
>>some
>>> kind of rollback. I'm not saying don't have the individual functions but
>>> complement then with 1 call that updates everything.
>>
>>This would only push the atomic update problem into the kernel. As a
>>further complication, the system call would probably need to support
>>update atomicity for any subset of the attributes or even any set of
>>non-overlapping subsets.
>
> As as userspace dev thats exactly where I want it.

There's a sizable amount of policy decisions involve here, eg, what does
the application want to do? Eg, "Apply all changes and roll all applied
ones back if one of them can't be applied?" vs "Apply as many changes as
can be applied?"

I've encountered both in application code already.

Because of this, putting this in the kernel is IMO not a good idea.

>>It's also not really difficult to make this appear atomically to other
>>applications: Start with creating a target file whith some unique,
>>internal name. Change all attributes supposed to be changed. If
>>everything succeeded, use link(2) to associate the existing file with the
>>'real' name it's supposed to have, finally, regardless of success or
>>failure of the preceding steps, unlink the internal name.

> Surely most (all) kernels have some kind of filesystem lock on inodes
> preventing 2 or more processes updating them simultaniously otherwise you could
> end up with serious corruption.

Obviously. But the problem can be solved in an application and without
implementing rollback of individual changes, see algorithm described
above.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor