Sun 20 Jul 2014 10:59:57 PM UTC, comment #2:
I'm inclined to implement the feature, but closely following the behaviour of Solaris 10 in particular (I didn't check other versions) may not be the best approach, since that implementation somewhat violates the principle of least astonishment:
When reading the input file (named via admin -i, for example) only the owner's execute permission bit is significant. The setting of this bit is copied however to all three of the execute bits in the history file [note 1] if the input , and in turn that is copied to the mode bits of the subsequent gotten file.
The result is that you take a file executable by owner only, check it into SCCS, check it out again, and suddenly it's world-executable (depending on your umask).
[note 1]: I assume this happens because the history file and the gotten file are created with mode 0666 (if the original file was not owner-executable) or mode 0777 (if the original file was not owner-executable).
( for mask in 0111 0011 0001 0000; do umask $mask; echo; echo umask=$mask; rm -f
s.x; touch x; chmod 0750 x; echo Original mode:; ls -ld x; admin -i s.x < x 2>/dev/null ; echo Mode of resulting history file:; ls -l s.x; rm -f x; get s.x >/dev/null 2>&1; echo Mode of gotten file:; ls -l x; rm -f x s.x; done )
umask=0111
Original mode:
-rwxr-x--- 1 jay csw 0 Jul 21 00:48 x
Mode of resulting history file:
-r--r--r-- 1 jay csw 146 Jul 21 00:48 s.x
Mode of gotten file:
-r--r--r-- 1 jay csw 0 Jul 21 00:48 x
umask=0011
Original mode:
-rwxr-x--- 1 jay csw 0 Jul 21 00:48 x
Mode of resulting history file:
-r-xr--r-- 1 jay csw 146 Jul 21 00:48 s.x
Mode of gotten file:
-r-xr--r-- 1 jay csw 0 Jul 21 00:48 x
umask=0001
Original mode:
-rwxr-x--- 1 jay csw 0 Jul 21 00:48 x
Mode of resulting history file:
-r-xr-xr-- 1 jay csw 146 Jul 21 00:48 s.x
Mode of gotten file:
-r-xr-xr-- 1 jay csw 0 Jul 21 00:48 x
umask=0000
Original mode:
-rwxr-x--- 1 jay csw 0 Jul 21 00:48 x
Mode of resulting history file:
-r-xr-xr-x 1 jay csw 146 Jul 21 00:48 s.x
Mode of gotten file:
-r-xr-xr-x 1 jay csw 0 Jul 21 00:48 x
If the original file is not owner-executable, the history file (and this subsequent gotten files) are not executable at all:
( for mask in 0111 0011 0001 0000; do umask $mask; echo; echo umask=$mask; rm -f
s.x; touch x; chmod 0651 x; echo Original mode:; ls -ld x; admin -i s.x < x 2>/dev/null ; echo Mode of resulting history file:; ls -l s.x; rm -f x; get s.x >/dev/null 2>&1; echo Mode of gotten file:; ls -l x; rm -f x s.x; done )
umask=0111
Original mode:
-rw-r-x--x 1 jay csw 0 Jul 21 00:57 x
Mode of resulting history file:
-r--r--r-- 1 jay csw 146 Jul 21 00:57 s.x
Mode of gotten file:
-r--r--r-- 1 jay csw 0 Jul 21 00:57 x
umask=0011
Original mode:
-rw-r-x--x 1 jay csw 0 Jul 21 00:57 x
Mode of resulting history file:
-r--r--r-- 1 jay csw 146 Jul 21 00:57 s.x
Mode of gotten file:
-r--r--r-- 1 jay csw 0 Jul 21 00:57 x
umask=0001
Original mode:
-rw-r-x--x 1 jay csw 0 Jul 21 00:57 x
Mode of resulting history file:
-r--r--r-- 1 jay csw 146 Jul 21 00:57 s.x
Mode of gotten file:
-r--r--r-- 1 jay csw 0 Jul 21 00:57 x
umask=0000
Original mode:
-rw-r-x--x 1 jay csw 0 Jul 21 00:57 x
Mode of resulting history file:
-r--r--r-- 1 jay csw 146 Jul 21 00:57 s.x
Mode of gotten file:
-r--r--r-- 1 jay csw 0 Jul 21 00:57 x
|