Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004906OCamlOCaml generalpublic2009-11-02 12:492013-07-06 10:46
Reporterfhars 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionno change required 
PlatformOSOS Version
Product Version3.11.1 
Target Version4.00.2+devFixed in Version 
Summary0004906: $PWD not set in Sys.command after Sys.chdir on Solaris
DescriptionIf 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 InformationFor 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"
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005145)
doligez (administrator)
2009-11-02 14:14

This smells like a bug in your shell. It's the shell launched by Sys.command
that is supposed to set the PWD variable.
(0005156)
gerd (reporter)
2009-11-09 17:33

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.
(0008097)
doligez (administrator)
2012-09-17 17:42

Do we care about Solaris enough to implement a workaround?

Note that we'll also need to change the makefiles.
(0009713)
xleroy (administrator)
2013-07-06 10:46

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.

- Issue History
Date Modified Username Field Change
2009-11-02 12:49 fhars New Issue
2009-11-02 14:14 doligez Note Added: 0005145
2009-11-09 17:33 gerd Note Added: 0005156
2009-12-08 17:46 doligez Status new => acknowledged
2012-07-11 13:34 doligez Target Version => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-17 17:42 doligez Note Added: 0008097
2012-09-17 17:42 doligez Target Version 4.00.1+dev => 4.00.2+dev
2013-07-06 10:46 xleroy Note Added: 0009713
2013-07-06 10:46 xleroy Status acknowledged => resolved
2013-07-06 10:46 xleroy Resolution open => no change required


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker