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
Display paths using backslashes on Windows #658
Conversation
Do you know if this affects |
@@ -373,7 +373,7 @@ otherlibs/dynlink/dynlink.cmxa: otherlibs/dynlink/natdynlink.ml | |||
|
|||
utils/config.ml: utils/config.mlp config/Makefile | |||
@rm -f utils/config.ml | |||
sed -e "s|%%LIBDIR%%|$(LIBDIR)|" \ | |||
sed -e "s|%%LIBDIR%%|$(shell echo $(LIBDIR)|sed -e 's/\//\\\\\\\\\\\\\\\\/g')|" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this fine escape sequence could be preceded by a comment reminding the reader what it does.
Also, it might be clearer if another character (e.g. colon) were used as the sed command delimiter, as then you will remove one backslash. The same applies below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
In principle, it shouldn't make any difference - ocamlbuild after 3.11.1 was already using Filename.concat for the limited place where it's used (ocamlbuild -where). |
In order to keep life sane, config/Makefile sensibly uses forward-slashes for the Windows builds (e.g. PREFIX=C:/OCaml). While Windows supports paths with either forward or back-slashes (even permitting them to be mixed in the same path), forward-slashes look confusing to non-expert Windows users and mixing the two looks extremely amateur. Patch ensures that when LIBDIR is displayed (in ocamlc -v, ocamlc -config, etc.) that forward-slashes are converted to back-slashes. It also corrects the generation of ld.conf to use them.
I am seriously concerned that you're making the life of OCaml Windows users (even) harder with this change. Backslashes are a quotation nightmare, and most of OCaml Windows software is built using Cygwin. |
If so, should it not be the other way and ensuring that
For management, OPAM will reduce the exposure of problems to the (Windows) maintainer for any given package, because the patches will already be there (and hopefully heading upstream) |
@@ -373,7 +373,8 @@ otherlibs/dynlink/dynlink.cmxa: otherlibs/dynlink/natdynlink.ml | |||
|
|||
utils/config.ml: utils/config.mlp config/Makefile | |||
@rm -f utils/config.ml | |||
sed -e "s|%%LIBDIR%%|$(LIBDIR)|" \ | |||
# Convert forward-slashes in LIBDIR to backslashes | |||
sed -e "s|%%LIBDIR%%|$(shell echo $(LIBDIR)|sed -e 's:/:\\\\\\\\\\\\\\\\:g')|" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could simplify this to:
sed -e "s|%%LIBDIR%%|$(subst /,\\\\,$(LIBDIR))|" \
and avoid problems with spaces at the beginning and end of $(LIBDIR)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doh - seeing the wood for the trees! Can't believe I didn't think to use $(subst ..)
instead! I'll push a new version later.
About the concerns raised by @xavierleroy, we should ask @alainfrisch. |
I've also, as of yesterday, got OPAM 2.0 capable of installing all 80 Windows versions of OCaml since 3.07 (9GB!) which are all patched with this GPR, so the testing against packages out there can hopefully be considerable... |
I don't really have an opinion. Looks like a low-risk and low-benefit proposal. Low-risk, because a package broken by backslashes would probably be broken already, but it's hard to be sure. I'm tempted to follow a non-technical argument: @dra27 does a marvelous job at improving support for Windows and seems confident in this one, so I would trust his judgment. |
The number of windows users is far too low to enforce coding standards for configure scripts, test scripts. etc. You often see something like this in configure scripts and similar locations:
As soon as OCAMLLIB contains backslashes, all such constructs become problematic (depending on the shell you are using). |
That example is already in trouble, regardless of forward or backslashes - it's not handling the The problem only occurs when the result is written, say, by a While I know you've ported many more packages than I have, I've never had trouble upstreaming fixes - although the patches often take months/years actually to be merged, sometimes! It's also often generic build systems which need fixing - e.g. OCamlMakefile, ocaml-autoconf, ocamlbuild (all of which I have had Windows-related patches accepted for), so at least the fixes in one often benefit another. A few other thoughts for why we might hope that the past doesn't indicate the future:
|
Six months later, do we better understand the problem we're trying to solve here and how much breakage the solution can cause? Because I still don't. |
It's still ticking over - the Windows ports in https://github.com/dra27/opam-repository/tree/next-windows all use this patch... it should therefore be getting much more thrashing over the next few months. I'm expecting that it will be for after 4.05 (assuming it makes it!) |
@dra27 should be this PR closed then? Since there seem no decision to include it at all? |
@dra27 do you have the data on how much breakage we can expect from this PR ? |
Not at this stage, no - my guess it will be becoming a lower-impact patch, since Dune and friends do things properly (i.e. |
Enable last dynlink test
* Add optional publication date to job records. Display it on the page. Sort offered positions, fresh first. * Tried to add job publication to previously published jobs * Removed closed position Co-authored-by: Cuihtlauac ALVARADO <cuihtmlauac@tarides.com>
Packaging up myriad OCaml versions ready for native Windows OPAM has finally made me fix a nagging irritation of the last decade or so...!
The premise is simple: while they are supported, professional Windows applications do not use forward-slashes in paths. Period.
This patch:
utils/config.ml
to translate forward-slashes (which are legitimately needed in the Unix-based build system) to back-slashes, meaning thatocamlc -config
(andocamlc -v
) display the default standard library location "correctly".byterun/ld.conf
ld.conf
A few minor observations:
configure
script for how this should be done)ld.conf
.Makefile
?