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

py2/py3 compatibility for urllib/urllib2 #266

Merged
merged 2 commits into from
Oct 27, 2016
Merged

py2/py3 compatibility for urllib/urllib2 #266

merged 2 commits into from
Oct 27, 2016

Conversation

alaindomissy
Copy link
Contributor

Documentation at http://singularity.lbl.gov/docs-exec shows running this example
$ singularity exec docker://python:latest /usr/local/bin/python hello.py
Doing so with python3 as default python interpreter brings up an error as urllib2 is python2 only:
ImportError: No module named 'urllib2'
This is a change to make the code py2/py3 compatible

Documentation at http://singularity.lbl.gov/docs-exec shows running this example
$ singularity exec docker://python:latest /usr/local/bin/python hello.py
Doing so with python3 as default python interpreter brings up an error as urllib2 is python2 only:
ImportError: No module named 'urllib2'
This is a change to make the code py2/py3 compatible
@gmkurtzer
Copy link
Contributor

Hi @alaindomissy, this looks good to me but it is @vsoch's code so I want her thumbs up too.

Thanks!

@alaindomissy
Copy link
Contributor Author

Actually, I still have a problem with python3. I now get this error :
Error getting pull token for repository library/python.latest, exiting.
ERROR: Aborting with RETVAL=0

@vsoch
Copy link
Collaborator

vsoch commented Oct 25, 2016

I can fix this up this weekend - just did this exact thing for another project actually!

in python3 urllib.request.Request.read() returns a bytes object
this is a change to decode
@alaindomissy
Copy link
Contributor Author

There was another python3 issue. It is now working for me in both py2 and py3.

@vsoch vsoch merged commit 357a10c into apptainer:master Oct 27, 2016
@vsoch
Copy link
Collaborator

vsoch commented Oct 27, 2016

ok, this looks good. It would be good to have some tests for this, but it doesn't hurt to fix the incompatibility even without. Thanks for your help doing this!

DrDaveD pushed a commit to DrDaveD/singularity that referenced this pull request Aug 25, 2021
We were previously setting `--user-xattrs` / `--no-xattrs` based on
the current euid when calling `unsquashfs`. However, in a non-setuid
install `--fakeroot` build the euid is 0, so the flags will not be
set. On distributions other than EL / Fedora (i.e. Debian / Ubuntu
which are not selinux native), this can cause failed extraction.

Decide if we are performing a rootless extraction based on the host
uid, outside of any namespace that is in play.

Fixes: apptainer#266
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants