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

Bug 884071

Summary: sys-apps/portage - handle PermissionError from lockfile() portage.package.ebuild.fetch.fetch()?
Product: Portage Development Reporter: emdee_is <emdee_is>
Component: CoreAssignee: Portage team <dev-portage>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Perplexing traceback from media-libs/virglrenderer-0.10.1
context diff for non-python programmers

Description emdee_is 2022-12-02 22:54:21 UTC
Created attachment 839195 [details]
Perplexing traceback from media-libs/virglrenderer-0.10.1

If the file lock at L1267 of portage/package/ebuild/fetch.py 
```
 file_lock = lockfile(myfile_path, wantnewlockfile=1, **lock_kwargs)
```
fails the user ends up with a perplexing double traceback (attached).

There should be an Exception clause added to the try: that signals
useful information back to the user:
```
                                                 
                except Exception as e:
                    writemsg_level(
                        _(
                            "!!! Unable to lock file  "
                            "%s \n"
                            "!!!   %s\n"
                        )
                        % (str(e), myfile,),
                        level=logging.ERROR,
                        noiselevel=-1,
                    )
                    return 0
```
Comment 1 emdee_is 2022-12-03 00:57:41 UTC
Created attachment 839201 [details, diff]
context diff for non-python programmers
Comment 2 Mike Gilbert gentoo-dev 2022-12-03 02:47:11 UTC
I guess we don't really expect to get a PermissionError when creating a lock file. If that happens, something has probably gone horribly wrong.

The traceback doesn't seem too "perplexing" to me, and would actually be quite useful in debugging an error that should really never happen.