timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-53046] jenkins.war deleted all my files in current working dir #10013

Open timja opened 6 years ago

timja commented 6 years ago

jenkins.war deleted all my files even itself.

 

I just want to follow the instructions on the official website:https://jenkins.io/doc/pipeline/tour/getting-started/ but I lost my files now. 

 

following is the errors:

➜  jenkins java -jar jenkins.war --httpPort=8080 .

Running from: /home/will/Downloads/jenkins/jenkins.war

webroot: $user.home/.jenkins

Aug 15, 2018 11:03:59 AM org.eclipse.jetty.util.log.Log initialized

INFO: Logging initialized @212ms to org.eclipse.jetty.util.log.JavaUtilLog

Aug 15, 2018 11:03:59 AM winstone.Logger logInternal

INFO: Beginning extraction from war file

Aug 15, 2018 11:03:59 AM winstone.Logger logInternal

INFO: Jetty shutdown successfully

java.io.FileNotFoundException: /home/will/Downloads/jenkins/jenkins.war (No such file or directory)

        at java.util.zip.ZipFile.open(Native Method)

        at java.util.zip.ZipFile.(ZipFile.java:225)

        at java.util.zip.ZipFile.(ZipFile.java:155)

        at java.util.jar.JarFile.(JarFile.java:166)

        at java.util.jar.JarFile.(JarFile.java:130)

        at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:261)

        at winstone.HostConfiguration.(HostConfiguration.java:81)

        at winstone.HostGroup.initHost(HostGroup.java:66)

        at winstone.HostGroup.(HostGroup.java:45)

        at winstone.Launcher.(Launcher.java:145)

        at winstone.Launcher.main(Launcher.java:354)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at Main._main(Main.java:312)

        at Main.main(Main.java:136)

Aug 15, 2018 11:03:59 AM winstone.Logger logInternal

SEVERE: Container startup failed                                                                          
java.io.FileNotFoundException: /home/will/Downloads/jenkins/jenkins.war (No such file or directory)       
        at java.util.zip.ZipFile.open(Native Method)                                                      
        at java.util.zip.ZipFile.(ZipFile.java:225)                                                 
        at java.util.zip.ZipFile.(ZipFile.java:155)                                                 
        at java.util.jar.JarFile.(JarFile.java:166)                                                 
        at java.util.jar.JarFile.(JarFile.java:130)                                                 
        at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:261)                              
        at winstone.HostConfiguration.(HostConfiguration.java:81)                                   
        at winstone.HostGroup.initHost(HostGroup.java:66)                                                 
        at winstone.HostGroup.(HostGroup.java:45)                                                   
        at winstone.Launcher.(Launcher.java:145)                                                    
        at winstone.Launcher.main(Launcher.java:354)                                                      
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                    
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                  
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)          
        at java.lang.reflect.Method.invoke(Method.java:498)                                               
        at Main._main(Main.java:312)                                                                      
        at Main.main(Main.java:136)      

and now my files are gone. This bug is very annoying. 

 


Originally reported by lazydomino, imported from: jenkins.war deleted all my files in current working dir
  • status: Open
  • priority: Critical
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 6 years ago

oleg_nenashev:

I believe this is because of the dot in the end of the command line.

In the documentation the dot is not a part of the command line sample, it just ends the sentence. Anyway , it makes sense to update the doc to prevent confusion

 

timja commented 6 years ago

lazydomino:

oleg_nenashev ohh my god.. This dot is very confusing.  But the application should not remove files recursively without any notification (in any uncertain situation). This is a disaster for users. 

timja commented 6 years ago

danielbeck:

Pretty sure https://github.com/jenkinsci/winstone/blob/04bcf4e65a19ceacb93df9dcec8fefe3b638a95d/src/main/java/winstone/HostConfiguration.java#L252 is the culprit, from the first mode in https://github.com/jenkinsci/winstone/#deployment-choices

This seems a bit too clever.

timja commented 6 years ago

danielbeck:

I wonder whether this could be changed to require an absolute path be specified for a webroot dir. This way, simple words aren't enough. Any real deployments will specify full paths anyway.