Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add os.chflags() and os.lchflags() where available #43370

Closed
levinsm mannequin opened this issue May 17, 2006 · 9 comments
Closed

add os.chflags() and os.lchflags() where available #43370

levinsm mannequin opened this issue May 17, 2006 · 9 comments
Assignees
Labels
extension-modules C modules in the Modules dir

Comments

@levinsm
Copy link
Mannequin

levinsm mannequin commented May 17, 2006

BPO 1490190
Nosy @loewis, @birkenfeld
Files
  • chflags-patch: patch
  • updated-chflags-patch: revised version of patch
  • chflags.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/loewis'
    closed_at = <Date 2007-12-04.08:38:26.762>
    created_at = <Date 2006-05-17.11:45:34.000>
    labels = ['extension-modules']
    title = 'add os.chflags() and os.lchflags() where available'
    updated_at = <Date 2007-12-04.08:38:26.751>
    user = 'https://bugs.python.org/levinsm'

    bugs.python.org fields:

    activity = <Date 2007-12-04.08:38:26.751>
    actor = 'loewis'
    assignee = 'loewis'
    closed = True
    closed_date = <Date 2007-12-04.08:38:26.762>
    closer = 'loewis'
    components = ['Extension Modules']
    creation = <Date 2006-05-17.11:45:34.000>
    creator = 'levinsm'
    dependencies = []
    files = ['7258', '7259', '7260']
    hgrepos = []
    issue_num = 1490190
    keywords = ['patch']
    message_count = 9.0
    messages = ['50263', '50264', '50265', '50266', '50267', '50268', '50269', '56988', '58179']
    nosy_count = 4.0
    nosy_names = ['loewis', 'nnorwitz', 'georg.brandl', 'levinsm']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1490190'
    versions = ['Python 2.5']

    @levinsm
    Copy link
    Mannequin Author

    levinsm mannequin commented May 17, 2006

    The return value from os.stat() includes st_flags on some systems, but
    currently there's not much that can be done with the value; this patch aims
    to make st_flags useful by adding some associated constants to stat.py and
    the corresponding chflags() and lchflags() functions in posixmodule. For
    completeness, shutil.copystat() is also updated to call os.chflags() where
    it's available.

    @levinsm levinsm mannequin assigned nnorwitz May 17, 2006
    @levinsm levinsm mannequin added the extension-modules C modules in the Modules dir label May 17, 2006
    @levinsm levinsm mannequin assigned nnorwitz May 17, 2006
    @levinsm levinsm mannequin added the extension-modules C modules in the Modules dir label May 17, 2006
    @birkenfeld
    Copy link
    Member

    Logged In: YES
    user_id=849994

    Patch looks good. Do we want to include it?

    @nnorwitz
    Copy link
    Mannequin

    nnorwitz mannequin commented May 19, 2006

    Logged In: YES
    user_id=33168

    What operating systems is this available on? The only one
    I've found is OS X. The man page says it's from BSD 4.4. I
    tried on Linux of various flavors (4+), Solaris, and Tru64.
    None of them had chflags. I also could only find some of
    the flags in my sys/stat.h that were added to stat.py.
    stat.h didn't have UF_NOUNLINK, SF_NOUNLINK, SF_SNAPSHOT.

    As far as the patch itself, it looks good. There are a
    couple of changes if this should be accepted though: doc
    needs \versionadded{2.5}, I would prefer flags as the var
    name rather than i in posixmodule.c (btw you shouldn't need
    to init path).

    Also would need to update Misc/NEWS and ACKS if accepted.

    @levinsm
    Copy link
    Mannequin Author

    levinsm mannequin commented May 19, 2006

    Logged In: YES
    user_id=1522893

    In addition to MacOS, chflags(2) is available on FreeBSD,
    OpenBSD, and
    NetBSD. The flags in Lib/stat.py are the full set of
    available values
    although, as you noted, MacOS hasn't (yet) implemented
    several of them.

    Thanks for the comments - I've attached an updated version
    of the patch
    incorporating your suggestions.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Feb 19, 2007

    Thanks for the patch. Committed as r53826.

    @nnorwitz
    Copy link
    Mannequin

    nnorwitz mannequin commented Mar 20, 2007

    It looks like Tru64 does have some version of chflags, however, it is undocumented and apparently causes python to exit. It is at least one of the reasons for the recent buildbot failures:

    http://python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/1550/step-test/0

    That doesn't really tell the whole story, but I logged on to the machine and ran the test, after modifying unittest to flush the stream, sigh :-( and got this:

    ringneck:/net/cci/nnorwitz/python/trunk.norwitz-tru64/nn-work-build % ./python -E -tt ./Lib/test/regrtest.py -v test_posix
    test_posix
    testNoArgFunctions (test.test_posix.PosixTester) ... ok
    test_access (test.test_posix.PosixTester) ... ok
    test_chdir (test.test_posix.PosixTester) ... ok
    test_chflags (test.test_posix.PosixTester) ... Bad system call

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Mar 21, 2007

    nnorwitz, can you please report whether the attached patch fixes it?
    File Added: chflags.diff

    @nnorwitz
    Copy link
    Mannequin

    nnorwitz mannequin commented Oct 31, 2007

    Martin's patch from 2007-03-21 fixed the problem with test_posix. It
    now passes all the tests (test_posix and rest of test suite). The
    tests/interpreter do not exit prematurely.

    I think it is good to apply this patch.

    @nnorwitz nnorwitz mannequin assigned loewis and unassigned nnorwitz Oct 31, 2007
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Dec 4, 2007

    Committed chflags.diff as r59317.

    @loewis loewis mannequin closed this as completed Dec 4, 2007
    @loewis loewis mannequin closed this as completed Dec 4, 2007
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant