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

ocamldep -one-line doesn't work with -sort #6968

Closed
vicuna opened this issue Aug 24, 2015 · 15 comments
Closed

ocamldep -one-line doesn't work with -sort #6968

vicuna opened this issue Aug 24, 2015 · 15 comments

Comments

@vicuna
Copy link

vicuna commented Aug 24, 2015

Original bug ID: 6968
Reporter: @dbuenzli
Status: confirmed (set by @gasche on 2015-08-25T17:43:22Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.02.3
Category: tools (ocaml{lex,yacc,dep,debug,...})
Tags: junior_job
Monitored by: @dbuenzli

Bug description

ocamldep -sort -one-line src/*.mli
src/uunf.mli src/uunf_string.mli

@vicuna
Copy link
Author

vicuna commented Aug 24, 2015

Comment author: @gasche

The --help documentation is rather bad, but the semantics are as follow:

  -sort enabled: just output the list of files in topological order 
  -sort not enabled: output pairs (target_files : dependencies)
     -one-line enabled: all dependencies on one line
     -one-line not enabled: with line cuts to not overflow 80 columns

The semantics of (-sort -one-line) is currently not defined, and in fact the current implementation of -sort will always print the list of files on one line only.

Would you prefer the combination -sort -one-line to be rejected, or some other semantics to be given to it?

@vicuna
Copy link
Author

vicuna commented Aug 24, 2015

Comment author: @dbuenzli

I think it would be nice that it does what it is supposed to do. For example this could be useful for tools to correctly handle the cases when paths have spaces in them.

@vicuna
Copy link
Author

vicuna commented Aug 24, 2015

Comment author: @gasche

I don't follow: what is -sort -one-line supposed to do? Can you explain why it does not do it?

@vicuna
Copy link
Author

vicuna commented Aug 24, 2015

Comment author: @dbuenzli

ocamldep -sort -one-line src/*.mli
src/uunf.mli
src/uunf_string.mli

@vicuna
Copy link
Author

vicuna commented Aug 24, 2015

Comment author: @dbuenzli

Ah sorry just completely misundestood.

@vicuna
Copy link
Author

vicuna commented Aug 24, 2015

Comment author: @dbuenzli

My brain was reading one-per-line.

@vicuna
Copy link
Author

vicuna commented Aug 24, 2015

Comment author: @dbuenzli

Well actually it's not only my brain :

ocamldep -help | grep "one-line"
-one-line Output one line per file, regardless of the length

@vicuna
Copy link
Author

vicuna commented Aug 24, 2015

Comment author: @gasche

The "one line per file" comment is trying to say that for each target, all its dependencies are displayed on the same line (instead of having line cuts to not overflow 80 columns).

Regardless of what the documentation says or the implementation does, I find the output you suggest rather counter-intuitive for an option whose name suggest that the output will be "on one line" -- and it would be contradictory with the behaviour of -one-line in absence of -sort, which is the one that is actually implemented and that (I suppose) some people use.

I'm open to suggestions of how to fix the documentation and/or implementation.

@vicuna
Copy link
Author

vicuna commented Aug 25, 2015

Comment author: @dbuenzli

Well I don't really care about the name but at least documentation should be fixed since reading:

ocamldep -help | grep "sort|one-line"
-one-line Output one line per file, regardless of the length
-sort Sort files according to their dependencies

You can legitimately see why I understand this that way. Besides I really think that what I understood should be provided. In the current state it's impossible to use ocamldep with file paths that have spaces in them.

@vicuna
Copy link
Author

vicuna commented Aug 25, 2015

Comment author: @gasche

I do understand your point, and I agree the documentation should be fixed.

How does make handle files with spaces in them? ocamldep should be Makefile-compatible, but if for example always quoting filenames that have spaces preserves compatibility, we could do that.

(I would also be fine with changing "ocamldep -sort -one-line" to do as you expect. In that case, I would be interested in a suggestion for a -help message for -one-line and/or -sort that would clarify the behavior of -one-line both with and without -sort. Don't be shy, I know you rock at documentation.)

@vicuna
Copy link
Author

vicuna commented Aug 25, 2015

Comment author: @dbuenzli

I would be interested in a suggestion for a -help message for -one-line and/or -sort that would clarify the behavior of -one-line both with and without -sort.

Well if you fix it for -sort then it makes all sense as it is no ?

@vicuna
Copy link
Author

vicuna commented Aug 25, 2015

Comment author: @gasche

Fair enough. Thanks!

@vicuna
Copy link
Author

vicuna commented Feb 20, 2019

Comment author: @gasche

In #2189 I proposed a -one-file-per-line option for ocamldep, and Nicolás suggested to drop the option and instead make it the default behavior (this will be available in 4.08). This suggests that -sort should use newlines between each file, unless -one-line is specified.

@dbuenzli
Copy link
Contributor

I think @gasche PR's solves this issue and it can be closed.

@nojb nojb closed this as completed Mar 15, 2019
@vicuna vicuna added the bug label Mar 20, 2019
@dbuenzli
Copy link
Contributor

Actually it's not. But I think it's easier for me to work around.

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

3 participants