jenkinsci / cobertura-plugin

Jenkins cobertura plugin
https://plugins.jenkins.io/cobertura/
MIT License
109 stars 133 forks source link

Long paths in nested folders / files can result in a "File name too long" error #135

Open christian-roggia opened 2 years ago

christian-roggia commented 2 years ago

Jenkins and plugins versions report

Environment Cobertura Jenkins Plugin version: 1.17

What Operating System are you using (both controller, and any agents involved in the problem)?

GKE - Kubernetes - Linux

Anything else?

The method IOUtil.sanitizeFilename is not safe for very nested folders / files. The method allows for filenames longer than 255 characters to be generated which will result in a "File name too long" error.

This issue was encountered in our Jenkins environment as paths can be longer than 255 characters but single file names can't.

https://github.com/jenkinsci/cobertura-plugin/blob/master/src/main/java/hudson/plugins/cobertura/IOUtils.java#L36-L46

moppetit commented 2 years ago

Also encountering this in our linux Jenkins environment with plugin v1.17 where generated file names are over 255 chars resulting in File name too long errors being thrown when attempting to publish the report.

@christian-roggia did you resolve or workaround this?

glechev commented 1 year ago

This is a regression in plugin 1.17 caused by this commit https://github.com/jenkinsci/cobertura-plugin/pull/130/files#diff-9c649eb6c5c9591cd38e9957dbd1d0d95d0542750395e19daf0a71d79734f54bL139

Previously this error was handled - it's still failing with 1.16, but it only prints the exception in the logs. In 1.17, the build step fails.

sq33G commented 1 year ago

Does anyone have a workaround for this?