mweibel / lcov-result-merger

Merges multiple lcov results into one
MIT License
102 stars 22 forks source link

[5.0.0] Issues with host system temp directory for transient lcov.info file #58

Open aram-yesildeniz opened 11 months ago

aram-yesildeniz commented 11 months ago

We run lcov-result-merger on a remote system, after updating to 5.0.0 we get the following error:

[Error: EXDEV: cross-device link not permitted, rename '/tmp/lcov-result-merger-abc/lcov.info' -> './coverage/lcov.info'] {
    errno: -18,
    code: 'EXDEV',
    syscall: 'rename',
    path: '/tmp/lcov-result-merger-abc/lcov.info',
    dest: './coverage/lcov.info'
}

Im posting this here as I guess that others will come across this too. The problem is easy solvable by adding the flag legacy-temp-file, e.g.:

./node_modules/.bin/lcov-result-merger './coverage/**/lcov.info' './coverage/lcov.info' --legacy-temp-file

mfittko commented 11 months ago

also had to downgrade to 4.1.0, as it happened just out of the blue today on CircleCI

mfittko commented 11 months ago

downgrade also didn't work, trying the legacy-temp-file patch

KADacey4 commented 11 months ago

Encountered the same issue. This bit of code: if (args.outFile) { await rename(tempFilePath, args.outFile); } else { process.stdout.write(await readFile(tempFilePath, 'utf-8')); }

should be changed to something like: if (args.outFile) { await copyFile(tempFilePath, args.outFile); } else { process.stdout.write(await readFile(tempFilePath, 'utf-8')); }

That should avoid the error when rename() is attempted on paths that are not on the same mounted filesystem. Linux permits a filesystem to be mounted at multiple points, but rename() does not work across different mount points, even if the same filesystem is mounted on both.

mdeanjones commented 10 months ago

Thanks for the insight @KADacey4.

I have a suspicion that things can be simplified further by removing the temp file behavior altogether. So far as I can reason, due to the way that we're trying to stitch various files together, everything needs to be held in memory for the duration of the process. At this point, I think the behavior might just be a historical holdover that it is time to retire.

Happy holidays all!

ringo-anva commented 6 months ago

It's merging but lines/function/branches are all 0/0 tried all versions.