The Wayback Machine - https://web.archive.org/web/20221220135323/https://github.com/python/cpython/issues/100221
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

make sharedinstall does not create lib-dynload in DESTDIR if lib-dynload exists in system already #100221

Open
mgorny opened this issue Dec 13, 2022 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@mgorny
Copy link
Contributor

mgorny commented Dec 13, 2022

Bug report

The Makefile.pre.in rule for creating directories is specified as:

$(DESTSHARED):
		@for i in $(DESTDIRS); \
		do \
			if test ! -d $(DESTDIR)$$i; then \
				echo "Creating directory $$i"; \
				$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
			else    true; \
			fi; \
		done

This means that if $(DESTSHARED) exists already (note: missing $(DESTDIR)!), i.e. Python 3.12 has been installed into the system, the directories in $(DESTDIR) won't be created and the successive sharedinstall rules fail due to the missing destination, e.g.:

/usr/bin/install -c -m 755 Modules/array.cpython-312-x86_64-linux-gnu.so /usr/lib/python3.12/lib-dynload/array.cpython-312-x86_64-linux-gnu.so
/usr/bin/install: cannot create regular file '/var/tmp/portage/dev-lang/python-3.12.0_alpha3/image/usr/lib/python3.12/lib-dynload/array.cpython-312-x86_64-linux-gnu.so': No such file or directory
/usr/bin/install -c -m 755 Modules/_asyncio.cpython-312-x86_64-linux-gnu.so /usr/lib/python3.12/lib-dynload/_asyncio.cpython-312-x86_64-linux-gnu.so
/usr/bin/install: cannot create regular file '/var/tmp/portage/dev-lang/python-3.12.0_alpha3/image/usr/lib/python3.12/lib-dynload/_asyncio.cpython-312-x86_64-linux-gnu.so': No such file or directory
/usr/bin/install -c -m 755 Modules/_bisect.cpython-312-x86_64-linux-gnu.so /usr/lib/python3.12/lib-dynload/_bisect.cpython-312-x86_64-linux-gnu.so
/usr/bin/install: cannot create regular file '/var/tmp/portage/dev-lang/python-3.12.0_alpha3/image/usr/lib/python3.12/lib-dynload/_bisect.cpython-312-x86_64-linux-gnu.so': No such file or directory

Full log: dev-lang:python-3.12.0_alpha3:20221207-142002.log

Your environment

  • CPython versions tested on: 3.12.0a3
  • Operating system and architecture: Gentoo Linux/amd64

Linked PRs

@mgorny mgorny added the type-bug An unexpected behavior, bug, or error label Dec 13, 2022
mgorny added a commit to mgorny/cpython that referenced this issue Dec 18, 2022
Fix creating install directories in `make sharedinstall` if they exist
already outside `DESTDIR`.  The previous make rules assumed that
the directories would be created via a dependency on a rule
for `$(DESTSHARED)` that did not fire if the directory did exist outside
`$(DESTDIR)`.

While technically `$(DESTDIR)` could be prepended to the rule name,
moving the rules for creating directories straight into
the `sharedinstall` rule seems to fit the common practices better.
Since the rule explicitly checks whether the individual directories
exist anyway, there seems to be no reason to rely on make determining
that implicitly as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant