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

ocamlbuild should not use tput on windows #4380

Closed
vicuna opened this issue Sep 5, 2007 · 7 comments
Closed

ocamlbuild should not use tput on windows #4380

vicuna opened this issue Sep 5, 2007 · 7 comments

Comments

@vicuna
Copy link

vicuna commented Sep 5, 2007

Original bug ID: 4380
Reporter: idadesub
Assigned to: @xclerc
Status: closed (set by @xavierleroy on 2012-03-24T14:01:42Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.10.0
Fixed in version: 3.12.1+dev
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Monitored by: mwipliez monate @db4

Bug description

On windows, if you do not specify "ocamlbuild -classic-display", ocamlbuild will always error out wih a message like "'tput' is not recognized as an internal or external command...". If tput doesn't work, it'd be really nice if ocamlbuild just fell back silently to using -classic-display without requiring that it is specified.

File attachments

@vicuna
Copy link
Author

vicuna commented Nov 14, 2007

Comment author: ertai

That's really strange, because the code tells me that we are already doing that. Our function that runs a command and returns its output can raise the Failure exception that is caught and then the number of columns is defaulted to 80.

@vicuna
Copy link
Author

vicuna commented Dec 3, 2007

Comment author: mwipliez

The ocamlbuild shipped with the 3.10 mingw version indeed tries to use tput under CMD and Cygwin (but not on MSYS):

set PATH=C:\Program Files\Objective Caml\bin
ocamlbuild -help
'tput' n'est pas reconnu en tant que commande interne
...

The version I just compiled from release310 seems to work fine under CMD and Cygwin when using the -help option:

set PATH=C:\ocamlmgw\bin
ocamlbuild -help
Usage ocamlbuild [options]
...

But now if I try, say, "ocamlbuild -clean", it still fails to use tput, and outputs the message:
ocamlbuild: "close_process_in" failed: Bad file descriptor

Hope this helps.

@vicuna
Copy link
Author

vicuna commented Apr 11, 2008

Comment author: mwipliez

Up: the issue is still present in OCaml 3.10.2.

@vicuna
Copy link
Author

vicuna commented May 14, 2008

Comment author: monate

The problem probably comes from ocamlbuild_unix_plugin.ml inside run_and_open.

close is called twice whenever it raises an exception : the second call will raise
Unix.EBADF which is never caught.

By the way the command in this function is not wrapped with "bash -c" contrary with the behaviour of sys_command. Is this the expected behaviour ?

Cheers

@vicuna
Copy link
Author

vicuna commented Jul 29, 2008

Comment author: jld

I've had to fix the double pclose locally, because NetBSD's tput doesn't seem to support the "cols" attribute; I've attached a diff of my change.

@vicuna
Copy link
Author

vicuna commented Jul 31, 2008

Comment author: ertai

I've applied the given patch to the CVS HEAD.

However I've not tested under Cygwin and I would like to know if this fixes the problem.

Thanks to idadesub, mwipliez and jld.

@vicuna
Copy link
Author

vicuna commented Dec 7, 2010

Comment author: @xclerc

Additionally to the fixed 'close' issue, the 'tput' command
is now called only if 'Sys.os_type' indicates that we are under
Unix (as 'tput' is also missing from a vanilla Cygwin installation).

@vicuna vicuna closed this as completed Mar 24, 2012
dra27 pushed a commit to dra27/ocaml that referenced this issue Feb 27, 2021
git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.12@11238 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant