Comments (7)
I can see the value of using env
to locate the interpreter in the non-installed version of LCOV. There are some platforms though where the use of env
as interpreter for system-installed scripts is discouraged [1]. While this may be automatically 'fixed' while building packages (as in Fedora 28), I would prefer if LCOV provided the same functionality independently of the platform it is being used on.
I like the idea proposed by @latk. I could imagine the following set of patches:
- Change instances of
perl -w
touse warning
- Use
/usr/bin/env
to locate interpreter scripts, both in Perl and Bash scripts - Modify the install.sh script to convert
env
invocations to absolute paths. The target paths could be taken from environment variables that are pre-defined in the LCOV Makefile to their current values (/usr/bin/perl
,/bin/bash
), but which could also be overridden during package installation, e.g. using
make install PERL_PATH=/usr/bin/perl BASH_PATH=/bin/bash
[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/#_shebang_lines
from lcov.
I can see three different use cases that should be addressed:
- Run lcov without installation (shebang line
#!/usr/bin/env perl
) - Install lcov with fixed interpreter path (shebang line
#!/usr/bin/perl
). This should be the default formake install
. - Install lcov with variable interpreter path (shebang line
#!/usr/bin/env perl
). This should be somehow selectable when runningmake install
.
This could be achieved as follows:
- All interpreter lines in the git source repository should be replaced by
#!/usr/bin/env
equivalents. - During
make install
, if PERL_PATH is set, the shebang lines of installed Perl programs should be replaced with the value of#!$PERL_PATH
. - The lcov Makefile should contain a default value for PERL_PATH (pointing to
/usr/bin/perl
).
For the use-case you described, you would unset PERL_PATH during installation:
make install PERL_PATH=
Note: BASH_PATH is not required as no installed script is using Bash.
from lcov.
This is now implemented with commits 2ff99ae, 0b378cb, and 74bae96.
Thanks to everyone involved for their suggestions!
from lcov.
I'm not sure whether either alternative is always better. Choosing #!/usr/bin/env perl
is inappropriate if lcov was installed for the system perl. I've encountered related problems in other Perl applications where required modules would no longer be found when the application was executed in a different perl's context. Here, this doesn't quite apply because lcov is implemented as a collection of self-contained scripts rather than a module, but it highlights potential difficulties.
Is there a way to fix up the shebang during installation so that lcov will always run with the perl it was installed under? E.g. I think Perl's EUMM is able to perform such rewriting (doc link, discussion), but it's use may be inappropriate in the context of lcov.
A better solution might be to have the make install
call fix up the shebang line on the fly if some variable is set.
from lcov.
Hi, indeed I was not aware of this issue. I've came across it packaging lcov for anaconda, and since they use contained environments, perl is in a non standard location. I've patched lcov scripts for that package, and it's working.
I'll consider patching the Makefile according to your suggestion.
Thanks for the feedback!
from lcov.
Is anyone currently working on implementing this change? If yes, and there is a chance that this is finished by start of February, it could be included in the next LCOV release.
from lcov.
Hi @oberpar , the solution you described above is not clear to me.
The for the use case I need the location of the interpreter is located in the PATH, for which it cannot be determined at install time. The concrete use case is supporting lcov in anaconda environments.
So the make install for this specific use-case would me some flag, e.g.:
make install USE_ENV_INTERPERTER=1
That would replace the shebang line by #!/usr/bin/env perl
same same for bash #!/usr/bin/env bash
.
Let me know if you agree with these
from lcov.
Related Issues (20)
- genhtml: ERROR: unexpected .info file record 'BFH:0' HOT 7
- What do these symbols for branch coverage mean? HOT 3
- `use "genhtml --ignore-errors source,source ..." to suppress this warning` HOT 6
- line coverage looks strange, with cross compilation and remote collection HOT 5
- Lcov2.0 filters normal branched when --filter branch and no_exception_branch=1 both works HOT 11
- function coverage not hit, then line coverage hit HOT 6
- geninfo settings don't work in config files in v2.1-beta1 or v2.1-beta2 HOT 3
- test_differential in the example now gives error HOT 1
- genhtml is too slow compared to old version HOT 10
- genhtml: --keep-going doesn't work for ERROR: <file> is not readable or doesn't exist. HOT 8
- how to see the verbose error msg? HOT 11
- LCOV 2.1 not compatible with Codecov HOT 9
- LCOV coverage.dat file has "DA:0:0" HOT 3
- lcov on x86 HOT 9
- genhtml: ERROR: Can't call method "branchElem" on an undefined value HOT 2
- Duplicate folder structure (--prefix does not help) HOT 2
- gcov error:std::bad_alloc HOT 7
- lcov fails with gcc 14 HOT 1
- perl2lcov: unexpected data type 'time' HOT 6
- genhtml package removed from PyPI HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lcov.