[Bug gcov-profile/77630] New: lcov fails to write files when relative paths are used but works with absolute paths
philipp.classen at gmx dot net
gcc-bugzilla@gcc.gnu.org
Sat Sep 17 23:17:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77630
Bug ID: 77630
Summary: lcov fails to write files when relative paths are used
but works with absolute paths
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: gcov-profile
Assignee: unassigned at gcc dot gnu.org
Reporter: philipp.classen at gmx dot net
Target Milestone: ---
I run into a problem with lcov 1.12. It fails when writing files when the
output file is a relative path but works when instead an absolute path is used,
for instance:
lcov -d /home/phil/ghost -a test_fast_cxxtest_gcov__base.info -a
test_fast_cxxtest_gcov__test.info -o test_fast_cxxtest_gcov__total.info
Combining tracefiles.
Reading tracefile test_fast_cxxtest_gcov__base.info
Reading tracefile test_fast_cxxtest_gcov__test.info
lcov: WARNING: function data mismatch at /home/phil/ghost/constants.h:1862
Writing data to test_fast_cxxtest_gcov__total.info
lcov: ERROR: cannot write to test_fast_cxxtest_gcov__total.info!
Running the command with strace reveals that it changes the directory to '/'.
Not sure why but it, at least, explains why it fails to write the file. Here is
part of the strace output:
brk(0x32c8000) = 0x32c8000
read(4, "2Ev\nFN:202,_ZN6Output8AutoLockD2"..., 8192) = 8192
read(4, "cxx1112basic_stringIcSt11char_tr"..., 8192) = 8192
read(4, "DA:1865,0\nDA:1866,0\nDA:1877,0\nDA"..., 8192) = 8192
read(4, ",_ZNK9__gnu_cxx17__normal_iterat"..., 8192) = 8192
read(4, "goryISt13move_iteratorIN9__gnu_c"..., 8192) = 8192
read(4, ":118,0\nDA:121,0\nDA:122,0\nDA:127,"..., 8192) = 8192
read(4, "\nDA:993,5\nDA:994,5\nDA:995,5\nDA:9"..., 8192) = 8192
read(4, "r_traitsIcESaIcEEEENSt9enable_if"..., 8192) = 8192
read(4, ",0\nDA:81,0\nDA:83,0\nDA:84,0\nDA:85"..., 8192) = 8192
read(4, "gnu_cxx17__normal_iteratorIPNSt7"..., 8192) = 8192
read(4, "DA:138,0\nDA:139,0\nLF:5\nLH:0\nend_"..., 8192) = 8192
read(4, "9_M_range_initializeISt13move_it"..., 8192) = 8192
read(4, "000,_Z22Build_R0_Occupied_ByteiR"..., 8192) = 8192
read(4, "DA:527,5\nDA:528,5\nDA:529,5\nDA:53"..., 8192) = 8192
read(4, "EEC2Ev\nFNDA:0,_ZNSaINSt7__cxx111"..., 8192) = 8192
read(4, "ZSt27__unguarded_partition_pivot"..., 8192) = 8192
read(4, "49,0\nDA:577,0\nDA:582,0\nDA:590,0\n"..., 8192) = 8192
read(4, "K9__gnu_cxx17__normal_iteratorIP"..., 8192) = 8192
read(4, "N:167,_ZNSt12_Vector_baseINSt7__"..., 8192) = 8192
read(4, "2basic_stringIcSt11char_traitsIc"..., 8192) = 8192
read(4, "iantEv\nFNDA:13395,_ZN10GhostUtil"..., 8192) = 1903
read(4, "", 8192) = 0
close(4) = 0
brk(0x32e9000) = 0x32e9000
brk(0x330a000) = 0x330a000
brk(0x332b000) = 0x332b000
chdir("/") = 0
write(2, "lcov: WARNING: function data mis"..., 75lcov: WARNING: function data
mismatch at /home/phil/ghost/constants.h:1862
) = 75
brk(0x334c000) = 0x334c000
brk(0x336d000) = 0x336d000
brk(0x338e000) = 0x338e000
brk(0x33af000) = 0x33af000
brk(0x33d0000) = 0x33d0000
brk(0x33f1000) = 0x33f1000
brk(0x3412000) = 0x3412000
brk(0x3433000) = 0x3433000
brk(0x3454000) = 0x3454000
brk(0x3475000) = 0x3475000
brk(0x3496000) = 0x3496000
brk(0x34b7000) = 0x34b7000
brk(0x34d8000) = 0x34d8000
brk(0x34f9000) = 0x34f9000
brk(0x351a000) = 0x351a000
brk(0x353c000) = 0x353c000
brk(0x3560000) = 0x3560000
brk(0x3584000) = 0x3584000
brk(0x35a5000) = 0x35a5000
brk(0x35c6000) = 0x35c6000
brk(0x35e7000) = 0x35e7000
brk(0x3608000) = 0x3608000
brk(0x3629000) = 0x3629000
brk(0x364a000) = 0x364a000
brk(0x366b000) = 0x366b000
brk(0x368c000) = 0x368c000
brk(0x36ad000) = 0x36ad000
brk(0x36ce000) = 0x36ce000
brk(0x36ef000) = 0x36ef000
brk(0x3711000) = 0x3711000
brk(0x3732000) = 0x3732000
brk(0x3753000) = 0x3753000
brk(0x3774000) = 0x3774000
brk(0x3795000) = 0x3795000
brk(0x37b6000) = 0x37b6000
brk(0x37d7000) = 0x37d7000
brk(0x37f8000) = 0x37f8000
brk(0x3819000) = 0x3819000
brk(0x383a000) = 0x383a000
brk(0x385b000) = 0x385b000
brk(0x387c000) = 0x387c000
brk(0x389d000) = 0x389d000
brk(0x38be000) = 0x38be000
brk(0x38df000) = 0x38df000
brk(0x3900000) = 0x3900000
brk(0x3921000) = 0x3921000
brk(0x3942000) = 0x3942000
brk(0x3963000) = 0x3963000
brk(0x3984000) = 0x3984000
brk(0x39a5000) = 0x39a5000
brk(0x39c8000) = 0x39c8000
brk(0x39e9000) = 0x39e9000
brk(0x3a0a000) = 0x3a0a000
brk(0x3a2b000) = 0x3a2b000
brk(0x3a4c000) = 0x3a4c000
brk(0x3a6d000) = 0x3a6d000
brk(0x3a8e000) = 0x3a8e000
brk(0x3ab0000) = 0x3ab0000
brk(0x3ad1000) = 0x3ad1000
brk(0x3af2000) = 0x3af2000
brk(0x3b13000) = 0x3b13000
brk(0x3b34000) = 0x3b34000
brk(0x3b55000) = 0x3b55000
brk(0x3b76000) = 0x3b76000
brk(0x3b97000) = 0x3b97000
brk(0x3bb8000) = 0x3bb8000
brk(0x3bd9000) = 0x3bd9000
brk(0x3bfa000) = 0x3bfa000
brk(0x3c1b000) = 0x3c1b000
brk(0x3c3c000) = 0x3c3c000
brk(0x3c5d000) = 0x3c5d000
brk(0x3c7e000) = 0x3c7e000
brk(0x3c9f000) = 0x3c9f000
brk(0x3cc0000) = 0x3cc0000
brk(0x3ce3000) = 0x3ce3000
brk(0x3d04000) = 0x3d04000
brk(0x3d25000) = 0x3d25000
brk(0x3d46000) = 0x3d46000
brk(0x3d67000) = 0x3d67000
brk(0x3d88000) = 0x3d88000
brk(0x3da9000) = 0x3da9000
brk(0x3dca000) = 0x3dca000
brk(0x3deb000) = 0x3deb000
brk(0x3e0c000) = 0x3e0c000
brk(0x3e2d000) = 0x3e2d000
brk(0x3e4e000) = 0x3e4e000
write(1, "Writing data to test_fast_cxxtes"..., 51Writing data to
test_fast_cxxtest_gcov__total.info
) = 51
open("test_fast_cxxtest_gcov__total.info", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1
EACCES (Permission denied)
chdir("/") = 0
write(2, "lcov: ERROR: cannot write to tes"..., 65lcov: ERROR: cannot write to
test_fast_cxxtest_gcov__total.info!
) = 65
rt_sigaction(SIGHUP, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, NULL, {0x7f7bd9aa5850, [], SA_RESTORER, 0x7f7bd967e0b0},
8) = 0
When using absolute paths, it succeeds. Trying to set the directory
"--base-directory" or "--directory" option did not make a difference, though.
There is also a related question with some background on stackoverflow:
http://stackoverflow.com/q/37675961/783510
It could be a regression introduced with 1.12.
I am using lcov 1.12 from the AUR on Arch Linux. Ubuntu seems to be affected,
too.
More information about the Gcc-bugs
mailing list