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

cloc 1.68 warning: which: no abc in (..) #105

Closed
foutrelis opened this issue Jun 13, 2016 · 11 comments
Closed

cloc 1.68 warning: which: no abc in (..) #105

foutrelis opened this issue Jun 13, 2016 · 11 comments

Comments

@foutrelis
Copy link

I'm seeing the following warning in cloc 1.68 which didn't occur with previous versions:

which: no abc in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)

Perl version shouldn't matter, but I'm using v5.22.2 on Arch Linux.

@AlDanial
Copy link
Owner

That's odd. The error is being triggered by line 133 where an attempt is made to see if SLOCCount is installed by way of its c_count command:

  133     $HAVE_SLOCCOUNT_c_count = external_utility_exists("echo 'abc' | c_count");

This works well enough on my Ubuntu 16.04 machine with and without c_count being installed. I'm wondering if Arch has a different implementation of c_count which accepts file names from STDIN, instead of lines of C code? (Also I'm wondering why I didn't just use the command which c_count to check for its existence ...)

What happens on your machine when you do

echo 'abc' | c_count

where abc does not correspond to a file name in your cwd?

You can delete the if statement at lines 132-134 to avoid the error. But of course I'd still like to understand and fix the issue for Arch Linux.

@foutrelis
Copy link
Author

I'm seeing the same warning with the following Perl snippet:

my $exe = "echo 'abc' | c_count";
system "which" . " $exe" . ' >/dev/null 2>&1';

The command it's running is which echo 'abc' | c_count >/dev/null 2>&1.

Perhaps you have abc somewhere in your $PATH and it's obscuring the issue?

@AlDanial
Copy link
Owner

abc is neither in my $PATH nor a file in my cwd. Nevermind the Perl code, what does

echo 'abc' | c_count

show from your command line?

@foutrelis
Copy link
Author

It shows bash: c_count: command not found.

Debian/Ubuntu seem to ship a custom implementation of which (as part of the debianutils package) whereas in Arch we package GNU which. This explains why you don't get any warnings printed to stderr when a program doesn't exist.

@AlDanial
Copy link
Owner

Thanks for the info. Can you suggest a mechanism to test for the existence of an executable that would work on Arch and Debian (and RHEL, etc)?

@AlDanial
Copy link
Owner

I installed VirtualBox on my Ubuntu system, created an Arch VM, and was able to duplicate the problem. So a fix should be forthcoming soon.

@AlDanial
Copy link
Owner

<oops, wrong button, didn't mean to close>

@AlDanial
Copy link
Owner

Not an obvious fix at all; the only way I could satisfy both Ubuntu and Arch was to test the output of c_count against some file--any file. I chose /bin/sh. At some point I expect to hear from owners of non-Windows systems saying they don't have a /bin/sh.

AlDanial added a commit that referenced this issue Jun 18, 2016
--use-sloccount (this should have been the logic from the start)
@relrod
Copy link

relrod commented Jun 21, 2016

@AlDanial When might this fix be pushed into a bugfix release? Updating the Fedora packages -- should I patch around this issue for now, or can we expect a release soon?

@AlDanial
Copy link
Owner

I'll make a release (v1.70) with this fix July 1st. Won't be able to get to it sooner.

@AlDanial
Copy link
Owner

AlDanial commented Jul 1, 2016

fyi, just released v1.70 which contains the fix

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

3 participants