public inbox for goredo-devel@lists.cypherpunks.ru
Atom feed
* File mode changes not properly updated for existing targets
@ 2023-10-05 14:21 spacefrogg
  2023-10-05 14:23 ` spacefrogg
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: spacefrogg @ 2023-10-05 14:21 UTC (permalink / raw)
  To: Goredo Devel

Hi,

I've discovered that, once a target was created by a .do file, its file 
modes are no longer properly updated, when the .do file is modified to 
do so. So, I have a target that is supposed to create a shell script. 
Initially, I forgot to make $3 executable. The target exists, now, under 
redo's control. I changed the .do file to add the executable bits to $3 
and ran redo again but nothing happened. After I deleted the target and 
ran redo again, the target was created with the proper file modes.

Could it be, that you are doing "cat" instead of "mv" on an existing 
target to avoid changing the inode? If so, be aware that the change from 
the old target to the new target would generally no longer be atomic to 
the outside world. POSIX only guarantees atomicity for mv and various 
filesystems have a very limited understanding of the atomicity of the 
write syscall.

Kind regards,
–Michael

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: File mode changes not properly updated for existing targets
  2023-10-05 14:21 File mode changes not properly updated for existing targets spacefrogg
@ 2023-10-05 14:23 ` spacefrogg
  2023-10-05 14:28 ` Jan Niklas Böhm
  2023-10-07 14:29 ` Sergey Matveev
  2 siblings, 0 replies; 5+ messages in thread
From: spacefrogg @ 2023-10-05 14:23 UTC (permalink / raw)
  To: Goredo Devel

Hi!
Okay, further testing showed that file modes are not updated exactly 
when the content of the target did not change. So, after checking the 
content of $3 and the old target, goredo should still update the mode 
bits. :)

Kind regards,
–Michael

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: File mode changes not properly updated for existing targets
  2023-10-05 14:21 File mode changes not properly updated for existing targets spacefrogg
  2023-10-05 14:23 ` spacefrogg
@ 2023-10-05 14:28 ` Jan Niklas Böhm
  2023-10-07 14:26   ` Sergey Matveev
  2023-10-07 14:29 ` Sergey Matveev
  2 siblings, 1 reply; 5+ messages in thread
From: Jan Niklas Böhm @ 2023-10-05 14:28 UTC (permalink / raw)
  To: goredo-devel

Hi Michael,

IIUC, when the target already exists, then the file is only touch'ed 
instead of being mv'ed over (or cat'ed).  This of course only happens 
when the already-present target and $3 have the same hash, which sounds 
like this was the case for you.

Cheers
Nik

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: File mode changes not properly updated for existing targets
  2023-10-05 14:28 ` Jan Niklas Böhm
@ 2023-10-07 14:26   ` Sergey Matveev
  0 siblings, 0 replies; 5+ messages in thread
From: Sergey Matveev @ 2023-10-07 14:26 UTC (permalink / raw)
  To: goredo-devel

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

*** Jan Niklas Böhm [2023-10-05 16:28]:
>IIUC, when the target already exists, then the file is only touch'ed instead
>of being mv'ed over (or cat'ed).  This of course only happens when the
>already-present target and $3 have the same hash, which sounds like this was
>the case for you.

Yes, exactly that happened.

-- 
Sergey Matveev (http://www.stargrave.org/)
OpenPGP: 12AD 3268 9C66 0D42 6967  FD75 CB82 0563 2107 AD8A

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: File mode changes not properly updated for existing targets
  2023-10-05 14:21 File mode changes not properly updated for existing targets spacefrogg
  2023-10-05 14:23 ` spacefrogg
  2023-10-05 14:28 ` Jan Niklas Böhm
@ 2023-10-07 14:29 ` Sergey Matveev
  2 siblings, 0 replies; 5+ messages in thread
From: Sergey Matveev @ 2023-10-07 14:29 UTC (permalink / raw)
  To: goredo-devel

[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

Greetings!

*** spacefrogg [2023-10-05 14:21]:
>Could it be, that you are doing "cat" instead of "mv" on an existing target
>to avoid changing the inode?

Definitely not, because, as you correctly noted, that would be
non-atomic operation.

>Okay, further testing showed that file modes are not updated exactly when
>the content of the target did not change. So, after checking the content of
>$3 and the old target, goredo should still update the mode bits. :)

Agreed, forget to take it into account! Will copy the mode of the file
to the target even if it is not renamed because of identical contents.

-- 
Sergey Matveev (http://www.stargrave.org/)
OpenPGP: 12AD 3268 9C66 0D42 6967  FD75 CB82 0563 2107 AD8A

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-07 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-05 14:21 File mode changes not properly updated for existing targets spacefrogg
2023-10-05 14:23 ` spacefrogg
2023-10-05 14:28 ` Jan Niklas Böhm
2023-10-07 14:26   ` Sergey Matveev
2023-10-07 14:29 ` Sergey Matveev