Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 94661

Summary: Use python-provided st_flags to read flags instead of calling lgetflags
Product: Portage Development Reporter: Diego Elio Pettenò (RETIRED) <flameeyes>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED WONTFIX    
Severity: normal CC: bsd+disabled, osx
Priority: High    
Version: 2.0   
Hardware: All   
OS: FreeBSD   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 94637    
Bug Blocks:    
Attachments: portage-2.0.51.22-nochflags.patch
2.0.51.22-chflags.patch
2.0.51.22-chflags.patch
2.0.51.22-chflags-bis.patch
portage-2.0.53_rc2-stflags.patch

Description Diego Elio Pettenò (RETIRED) gentoo-dev 2005-05-31 12:38:32 UTC
Currently portage uses the bsd_chflags module, installed with portage itself, to manipulate the FreeBSD flags. That module is most an hack and fails when destination ROOT is on a non-flags-capable filesystem such as NFS.

The attached patch, given the python patch at bug #94637, uses py-freebsd module (dev-python/py-freebsd, present in g/fbsd overlay) to achieve the same save/restore of flags but using a more pythonized way.

To use that on portage it needs to change the dependency conditioned to libc_FreeBSD? ( dev-python/py-freebsd $new_version_of_python_with_94637 ).
Then bsd_chflags can be dropped.

Thanks in advance, Diego
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-05-31 12:39:05 UTC
Created attachment 60296 [details, diff]
portage-2.0.51.22-nochflags.patch
Comment 2 Jason Stubbs (RETIRED) gentoo-dev 2005-06-01 07:29:24 UTC
Would it be possible to make some of those constants (st_flags & 0x0160016 and 
e[0] == 45) into human readable constants? 
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-06-04 06:19:12 UTC
The flags constant is something i don't know how to describe, it was took from   
hasproblems() function in bsd_chflags module. 
 
As for 51, it's just the error code for operation not supported, maybe I can 
declare a constant OperationNotSupported == 51 and then use that? 
 
Comment 4 Jason Stubbs (RETIRED) gentoo-dev 2005-06-06 07:49:23 UTC
51? I only see 45 in the patch. I checked the errno module and found that 45     
corresponds with EL2NSYNC (Level 2 not synchronized) and that 51 corresponds     
with EL2HLT (Level 2 halted) but does that make sense? I'd really expect     
something like ENOSYS or EINVAL...     
     
What does `python -c 'import errno; print errno.errorcode["45"]'` give you     
there? Whatever it is, that's probably what should be used.     
 
So, what's the status on bug #94637 then? 
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-06-06 07:58:14 UTC
though of something and wrote something else.. lately i'm being a bit 
confused, I know. 
 
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-06-08 09:20:18 UTC
Created attachment 60844 [details, diff]
2.0.51.22-chflags.patch

Updated patch
Comment 7 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-08-16 06:30:16 UTC
Created attachment 66075 [details, diff]
2.0.51.22-chflags.patch

Removed out the broken stuff and make 'freebsd' references changed to
'bsdutils' (hoping that py-freebsd's API is the one that will be used by other
modules, too).
Comment 8 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-08-16 07:07:40 UTC
Created attachment 66078 [details, diff]
2.0.51.22-chflags-bis.patch

New patch this time trying to avoid the ugly if to check if a file is not
writable.
This way isNotWritable can also be extended in future to carry other checks for
non-bsd flags.
Comment 9 Diego Elio Pettenò (RETIRED) gentoo-dev 2005-10-02 08:22:27 UTC
Created attachment 69728 [details, diff]
portage-2.0.53_rc2-stflags.patch

Backing off from the idea of using py-freebsd, it turned out to be unpractical
as it doesn't provide support for other systems like dragonfly, so spb's module
is still the best shot.

This patch just uses st_flags from stat() struct instead of using lgetflags, as
python 2.4.1-r1 and will-be-2.4.2 supports that natively.
Comment 10 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-07-19 18:57:37 UTC
Okay never mind.