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

$PWD not set in Sys.command after Sys.chdir on Solaris #4906

Closed
vicuna opened this issue Nov 2, 2009 · 4 comments
Closed

$PWD not set in Sys.command after Sys.chdir on Solaris #4906

vicuna opened this issue Nov 2, 2009 · 4 comments
Labels
Milestone

Comments

@vicuna
Copy link

vicuna commented Nov 2, 2009

Original bug ID: 4906
Reporter: fhars
Status: closed (set by @xavierleroy on 2015-12-11T18:20:04Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 3.11.1
Target version: 4.00.2+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: gerd

Bug description

If you start a command with Sys.command on Solaris (not OpenSolaris), $PWD always has the same value it had at the start of the program, even after a Sys.chdir:

    Objective Caml version 3.11.1

Sys.command "echo $PWD";;

/home/fhars/godi32/bin

  • : int = 0

Sys.chdir "/home/fhars";;

  • : unit = ()

Sys.command "echo $PWD";;

/home/fhars/godi32/bin

  • : int = 0

Sys.getcwd ();;

  • : string = "/home/fhars"

This at least breaks the build for godi.

Additional information

For comparision, the expected behaviour observed on linux:

    Objective Caml version 3.10.2

Sys.command "echo $PWD";;

/home/hars

  • : int = 0

Sys.chdir "bin";;

  • : unit = ()

Sys.command "echo $PWD";;

/home/hars/bin

  • : int = 0

Sys.getcwd ();;

  • : string = "/home/hars/bin"
@vicuna
Copy link
Author

vicuna commented Nov 2, 2009

Comment author: @damiendoligez

This smells like a bug in your shell. It's the shell launched by Sys.command
that is supposed to set the PWD variable.

@vicuna
Copy link
Author

vicuna commented Nov 9, 2009

Comment author: gerd

Yes, it's a bug in /bin/sh, or better, Solaris' /bin/sh predates the POSIX shell specification, and Sun never managed to switch to a compliant shell. I think it is pointless to make the vendor accountible - after all, we have to live with what exists on the OS.

Note that there are also $PWD references in the Ocaml Makefiles, i.e. the build is broken on Solaris.

@vicuna
Copy link
Author

vicuna commented Sep 17, 2012

Comment author: @damiendoligez

Do we care about Solaris enough to implement a workaround?

Note that we'll also need to change the makefiles.

@vicuna
Copy link
Author

vicuna commented Jul 6, 2013

Comment author: @xavierleroy

There are only two occurrences of ${PWD} in the OCaml Makefiles: one in ocamlbuild/Makefile, which is unused AFAIK, and one in testsuite/Makefile, which, one can hope, is always invoked from an interactive shell that sets $PWD correctly.

I'm marking this PR as resolved/no change required. It's not our job to work around every non-conformance of every operating system. Poor Solaris users can always set SHELL=/bin/bash or some reasonable shell.

@vicuna vicuna closed this as completed Dec 11, 2015
@vicuna vicuna added this to the 4.00.2 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant