Skip to content

Allow installing in folder with space in name#11590

Merged
dra27 merged 3 commits intoocaml:trunkfrom
Et7f3:Allow-install-path-with-space
Oct 18, 2022
Merged

Allow installing in folder with space in name#11590
dra27 merged 3 commits intoocaml:trunkfrom
Et7f3:Allow-install-path-with-space

Conversation

@Et7f3
Copy link
Copy Markdown
Contributor

@Et7f3 Et7f3 commented Oct 1, 2022

Hello,

As part of split of #10727 here a first step.
https://github.com/ocaml/ocaml/pull/10727/files#r748650610 comment associated.

This allow to install man page and be able to see it:

./configure --prefix="$PWD/install here"
make
make install
export MANPATH="$PWD/install here"/man
man Lazy # We get the recent version

check-stale allow finer message. So it it a improvement on itself and it works with space in path.

@Et7f3 Et7f3 changed the title fix(build): Repair make install Allow installing in folder with space in name Oct 1, 2022
@Et7f3 Et7f3 force-pushed the Allow-install-path-with-space branch from 4f5dc36 to cce0f57 Compare October 1, 2022 01:08
@dra27 dra27 self-assigned this Oct 1, 2022
@dra27 dra27 self-requested a review October 1, 2022 07:28
@shindere
Copy link
Copy Markdown
Contributor

shindere commented Oct 3, 2022 via email

Copy link
Copy Markdown
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix to man/Makefile is clearly correct (thanks!)

Other changes we've been making have been trying to move away from using shell constructs and the dancing with bash-isms, not to mention having to worry about locales at all, makes me very nervous about the other change. We have been stung - at considerable loss of time both to the original reporter and to those who had to reproduce and fix it - by the vagaries of shell commands being sensitive to user locales, and GNU make (like ISO C!) has the benefit of being evaluated in the C locale.

The test can fairly easily be kept in make, just by taking advantage of make -C <dir> -f <Makefile> to do the change of directory. I tested the idea in dra27@83b1238 which works both on Windows and macOS (I installing this over the top of a 4.12 installation). The crux of it is that the install:: target becomes:

.PHONY: install
# Ensure any pre-4.13 lowercased artefacts are removed on macOS and Windows
install::
	@$(MAKE) -C '$(INSTALL_LIBDIR)' -f '$(realpath Makefile.check-stale)' \
	         EXT=.cmi \
	         'ARTEFACTS=$(wildcard stdlib__*.cmi)' \
	         'INSTALL_LIBDIR=$(INSTALL_LIBDIR)'

which makes a recursive call in the target directory and the GNU make definition for $(stale) is expanded into MAkefile.check-stale as:

INSTALLED_ARTEFACTS = $(notdir $(wildcard stdlib__*$(EXT)))
STALE_ARTEFACTS = $(filter-out $(ARTEFACTS), $(INSTALLED_ARTEFACTS))
endif

and now $(STALE_ARTEFACTS) will be non-empty if any files with the old casing are found. The "trick" is that using -C avoids the need for specifying paths with spaces in them inside a Makefile (which is impossible)

@Et7f3
Copy link
Copy Markdown
Contributor Author

Et7f3 commented Oct 3, 2022

Ok so you want I commit your code with you as co-author ?

@dra27
Copy link
Copy Markdown
Member

dra27 commented Oct 4, 2022

If you're happy with that commit, sure - the main thing is that I think the check should be done using GNU make rather than using the shell, I just didn't want to suggest that before being sure that the solution actually worked (which is why I wrote the commit!)

@Et7f3
Copy link
Copy Markdown
Contributor Author

Et7f3 commented Oct 4, 2022

EXT=.cmi instead of .cm* is it for a reason ? Inlining it in the wildcard should be fine ?

@dra27
Copy link
Copy Markdown
Member

dra27 commented Oct 4, 2022

EXT=.cmi instead of .cm* is it for a reason ? Inlining it in the wildcard should be fine ?

As in https://github.com/ocaml/ocaml/pull/10301/files#r746338143 🙂

@Et7f3
Copy link
Copy Markdown
Contributor Author

Et7f3 commented Oct 4, 2022

A yes. Thx for reminder (it has been more than one year).

Co-authored-by: David Allsopp <david.allsopp@metastack.com>
Signed-off-by: Et7f3 <cadeaudeelie@gmail.com>
@Et7f3
Copy link
Copy Markdown
Contributor Author

Et7f3 commented Oct 6, 2022

Since installopt-default and install depend on this staleness check I keep the auxiliary target. I removed echo bashim with makefile error command and if to check if the variable is empty.

A HACKTOBERFEST-ACCEPTED label is appreciated if you consider this PR non-spammy.

@dra27
Copy link
Copy Markdown
Member

dra27 commented Oct 13, 2022

Sorry for the delay getting back to you, @Et7f3 - there's consensus that we can take an even simpler route with stdlib/Makefile and just delete the check for mis-cased artefacts completely! Would you be happy to make that change part of this PR? (it just means deleting entirely LL57-67, re-adding the .PHONY: install above L70 and deleting LL97-106)

@Et7f3
Copy link
Copy Markdown
Contributor Author

Et7f3 commented Oct 13, 2022

CI is green

Changes Outdated

### Build system:
- #11590: Allow installing to a destination path containing spaces.
- #11590: Delete the check for mis-cased artefacts
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think change is necessary - the PR still primarily allows installation to a destination path containing spaces!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok old commit 6ed82b5 I just reverted Changes

@Et7f3 Et7f3 force-pushed the Allow-install-path-with-space branch from 6ed82b5 to f459b70 Compare October 13, 2022 14:02
Copy link
Copy Markdown
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go with CI, thanks!

Thanks for your patience with this one - I’m reasonably confident that the next ones won’t take quite so much “to and fro” 🙂

@dra27 dra27 merged commit 9341e40 into ocaml:trunk Oct 18, 2022
@Et7f3 Et7f3 deleted the Allow-install-path-with-space branch October 21, 2022 00:17
@kit-ty-kate
Copy link
Copy Markdown
Member

Is there any chance this could be backported to the 4.14 and 5.0 branches?

@dra27
Copy link
Copy Markdown
Member

dra27 commented Jan 3, 2023

Certainly fine for the man/Makefile change - not instantly sure about the stdlib/Makefile change (it removes the test rather than fixing it)

@Et7f3
Copy link
Copy Markdown
Contributor Author

Et7f3 commented Jan 3, 2023

We have found a version that test and doesn't fail with space in path. Do you want I restore it ?

@dra27
Copy link
Copy Markdown
Member

dra27 commented Jan 4, 2023

No, it's OK, thanks - we certainly won't back-port a fix we didn't merge! @Octachron - can I manually push the man/Makefile change to 4.14+5.0 (possibly further, for cases where that's the only blocking issue for installing to directories with spaces)

@Octachron
Copy link
Copy Markdown
Member

The man changes seems very fine to backport directly to 4.14 and 5.0 to me.

dra27 added a commit that referenced this pull request Jan 4, 2023
- fix(build): Repair make install (in man/Makefile)
dra27 added a commit that referenced this pull request Jan 4, 2023
- fix(build): Repair make install (in man/Makefile)
@dra27
Copy link
Copy Markdown
Member

dra27 commented Jan 4, 2023

Pushed to both, thanks!

voodoos pushed a commit to voodoos/ocaml that referenced this pull request Feb 10, 2023
- fix(build): Repair make install (in man/Makefile)
ejgallego pushed a commit to ejgallego/ocaml that referenced this pull request Nov 5, 2025
- fix(build): Repair make install (in man/Makefile)
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.

5 participants