abh1sar opened a new issue, #14013:
URL: https://github.com/apache/cloudstack/issues/14013

   ### problem
   
   Backup works because mount options are processed inside the shell script 
`nasbackup.sh` where trailing spaces are not a problem.
   
   But restore (`LibvirtRestoreBackupCommandWrapper`) builds and runs mount in 
Java        
                              
   ```
                                                                    
     if (StringUtils.isNotBlank(mountOptions)) {                                
                                                           
         mountCmd.add("-o");                                                    
                                                           
         mountCmd.add(mountOptions);                                            
                                                           
     }                                                                          
                                                           
     Script.executeCommand(mountCmd.toArray(new String[0]));                    
                                                           
                                                                                
                                      
   ```                     
   Script.executeCommand(String...) builds a ProcessBuilder argument list       
                                                         
   mount receives the literal -o "vers=4.1 ". libmount splits options only on 
commas, so the trailing blank stays glued to the last option, and mount.nfs/the 
kernel rejects it as a malformed or unknown option ("an incorrect mount option 
was specified").
   
   `WARN  utils.script.Script (logid:435302bd) Process [445800] for command 
[sudo /usr/bin/mount -t nfs <redacted> encountered the error: [mount.nfs: an 
incorrect mount option was specified for 
/usr/share/cloudstack-agent/tmp/csbackup...`
   
   ### versions
   
   ACS 4.22.1
   
   ### The steps to reproduce the bug
   
   1. Create a backup repository - specify mount options (`vers=4.1 `) with a 
trailing space
   2. Create backup
   3. Restore backup - it fails
   ...
   
   
   ### What to do about it?
   
   Trim trailing whitespaces before using the mount options


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to