Hi Marcus,

[redirecting to misc@, this is not a bug and all is working as
intended]

By the time your recursive chflags gets to pkg_add, it will already
have the flag.  Note that these flags are per inode, and several files
under /usr/sbin have the same inode:

[weerd@despair] $ cd /usr/sbin; ls -li | grep 134232
134232 -r-xr-xr-x   7 root  bin         1473 Oct 27 03:48 fw_update
134232 -r-xr-xr-x   7 root  bin         1473 Oct 27 03:48 pkg_add
134232 -r-xr-xr-x   7 root  bin         1473 Oct 27 03:48 pkg_check
134232 -r-xr-xr-x   7 root  bin         1473 Oct 27 03:48 pkg_create
134232 -r-xr-xr-x   7 root  bin         1473 Oct 27 03:48 pkg_delete
134232 -r-xr-xr-x   7 root  bin         1473 Oct 27 03:48 pkg_info
134232 -r-xr-xr-x   7 root  bin         1473 Oct 27 03:48 pkg_sign

The recursive operation doesn't pay attention to this implementation
detail, so it first runs chflags against fw_update.  Then when it
finds pkg_add, it'll try to run chflags against it, but now it already
has the flag, so it gives you an error.

You will probably have seen multiple errors while running your
recursive chflags operation.  Same deal there.


Note that running chflags on files in your /usr/sbin directory will
be a problem come upgrade time.  You'll need to remove the flag before
you can upgrade.

Cheers,

Paul 'WEiRD' de Weerd

On Wed, Jan 23, 2019 at 12:46:43PM +0000, Marcus Pedersén wrote:
| Hi,
| 
| OpenBSD 6.4
| 
| I have a strange behavior on chflags.
| 
| If I run:
| 
| chflags schg /usr/sbin/pkg_add
| 
| This works fine and the schg flag is set.
| 
| 
| But if I run it recusively, as in:
| 
| chflags -R schg /usr/sbin/
| 
| I get the following error on pkg_add and a number of other files:
| 
| chflags: /usr/sbin/pkg_add: Operation is not permitted
| 
| 
| Still the schg flag is set.
| 
| 
| How come I get an error when running recurively but not when I run it on the 
same single file?
| 
| 
| I hope this will help you and if I have posted to the wrong address I 
apologize!!
| 
| Please, tell me where to post this if it is wrong!
| 
| 
| Best regards
| 
| Marcus Pedersén
| 
| ---
| När du skickar e-post till SLU så innebär detta att SLU behandlar dina 
personuppgifter. För att läsa mer om hur detta går till, klicka här 
<https://www.slu.se/om-slu/kontakta-slu/personuppgifter/>
| E-mailing SLU will result in SLU processing your personal data. For more 
information on how this is done, click here 
<https://www.slu.se/en/about-slu/contact-slu/personal-data/>

-- 
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.weirdnet.nl/                 

Reply via email to