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

lfec keeps non-files in file list args #109

Closed
oubiwann opened this issue Jan 22, 2015 · 4 comments
Closed

lfec keeps non-files in file list args #109

oubiwann opened this issue Jan 22, 2015 · 4 comments

Comments

@oubiwann
Copy link
Member

When running lfec with the output dir argument, I got these odd errors:

./-o.lfe:none: no such file or directory
<some path>.lfe:none: no such file or directory

When I debugged this in lfec, it turned out that when the file list is provided, the -o and <outputdir> are included in it.

I was going to mess with the pattern matching in the parse-opts function, but then it occurred to me that even with that, someone (or more likely someone's script) might still pass a file that didn't exist. As such, it seemed that a general filter might be a better approach (2 bids, one stone).

I'll submit the PR for this shortly.

@rvirding
Copy link
Member

I wonder if we should really silently remove files like this. It might cause confusion as errors will not show up.

@oubiwann
Copy link
Member Author

Hrm, I'm not sure what you mean ...

It's possible that people could have .erl, .ex, or .jxa files in one project. In general I'm pretty against removing files from someone's project ...

Side note: this patch was provided when I noticed that "-o" and "/output/path/" were being passed with the file args in lfec. If we don't use this patch to filter only .lfe files for lfec to compile, then we'll have to add a separate fix for making sure that options don't end up in the file args list ...

@rvirding
Copy link
Member

I think one reason you were getting that problem is that you were mixing flags and files. The lfe and lfec commands follow bash/sh conventions here rather that erl conventions. This means that all the flags and their arguments must come first, and as soon it detects an arg which is not a flag then it treats everything after that as files.

So if you write lfec foo.lfe -o mybin then you will get this error. You need to write lfec -o mybin foo.lfe. Lfec only recognises a fixed set of flags and you can explicitly end the flag section with a -- and everything after that is a file. So you can do lfec -o mybin -- -any-file-name.lfe.

That is why I was wondering whether we need to remove files from the list of files to compile. I didn't mean actually delete the actual files, not even I am that strict. :-)

Lfe behaves in the same way but arguments after the flags are the script name and then arguments.

@oubiwann
Copy link
Member Author

Oh, right. I discovered the ordering after that.

Thanks :-)

On Sun, Jan 25, 2015 at 10:56 AM, Robert Virding notifications@github.com
wrote:

I think one reason you were getting that problem is that you were mixing
flags and files. The lfe and lfec commands follow bash/sh conventions here
rather that erl conventions. This means that all the flags and their
arguments must come first, and as soon it detects an arg which is not a
flag then it treats everything after that as files.

So if you write lfec foo.lfe -o mybin then you will get this error. You
need to write lfec -o mybin foo.lfe. Lfec only recognises a fixed set of
flags and you can explicitly end the flag section with a -- and
everything after that is a file. So you can do lfec -o mybin --
-any-file-name.lfe.

Lfe behaves in the same way but arguments after the flags are the script
name and then arguments.


Reply to this email directly or view it on GitHub
#109 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants