tito wrote in
 <20240910210929.245867f7@devuan>:
 |On Tue, 10 Sep 2024 16:33:09 +0000
 |"OCathain, Art (DSIT)" <art.ocath...@dsit.gov.uk> wrote:
 |
 |> Busybox seems to be happy to overwrite a readonly file using cp. \
 |> A small example:
 |> 
 |> echo foo > source_file
 |> touch dest_file
 |> chmod -w dest_file
 |> cp source_file dest_file
 |> 
 |> I would expect the last line to fail, as indeed it does on Ubuntu \
 |> and MacOS. Instead dest_file is overwritten, and is now read/write.
 ...
 |Hi, 
 |you do this as regular user or root?
 |
 |tito@devuan:~$ echo foo > source_file
 |tito@devuan:~$ touch dest_file
 |tito@devuan:~$ ls -la dest_file 
 |-rw-r--r-- 1 tito tito 0 Sep 10 21:04 dest_file
 |tito@devuan:~$ chmod -w dest_file 
 |tito@devuan:~$ ls -la dest_file 
 |-r--r--r-- 1 tito tito 0 Sep 10 21:04 dest_file
 |tito@devuan:~$ cp source_file dest_file 
 |cp: cannot create regular file 'dest_file': Permission denied
 |tito@devuan:~$ su
 |root@devuan:/home/tito# cp source_file dest_file
 |root@devuan:/home/tito# ls -la dest_file 
 |-r--r--r-- 1 tito tito 4 Sep 10 21:05 dest_file
 |root@devuan:/home/tito# cat dest_file 
 |foo
 |
 |This example is with coreutlis cp.

Yeah it goes as far as that package maintainers hack installation
scripts / Makefile rules which set 0555 to 0755 because they want
to overcorrectly reflect reality.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to