newperms path with space causes line 21 error.


Recommended Posts

root@storage:~# newperms /mnt/user/downloads/Folder\ 5/
/mnt/user/downloads/Folder 5/
/usr/local/sbin/newperms: line 21: [: /mnt/user/downloads/Folder: binary operator expected
completed, elapsed time: 00:00:00
root@storage:~# newperms /mnt/user/downloads/Folder\ 5/
/mnt/user/downloads/Folder 5/
processing /mnt/user/downloads/Folder 5/
... chmod -R u-x,go-rwx,go+u,ugo+X /mnt/user/downloads/Folder 5/
... chown -R nobody:users /mnt/user/downloads/Folder 5/
... sync
completed, elapsed time: 00:00:02

 

Wrapping $1 on line 21 seems to fix this.

 

if [ -d $1 ] ; then

if [ -d "$1" ] ; then

 

I found this issue because despite the major change, I still constantly fight with permissions and constantly have to use newperms.

Link to comment
  • 3 months later...

This is still an issue.  Here is a bug report in the preferred format, if that helps:

 

unRAID OS Version:

6.1.7.  Based on the date of the original report, it was introduced in 6.1.3 or earlier.

 

Description:

newperms does not work on directories with spaces in the name

 

How to reproduce:

call newperms on a directory with spaces

newperms /mnt/user/share/directory with spaces/

 

Expected results:

the permissions on the files in the directory would be changed

 

Actual results:

/usr/local/sbin/newperms: line 21: [: too many arguments

 

Other information:

Line 21 is:

  if [ -d $1 ] ; then

but it should be:

  if [ -d "$1" ] ; then

All of the other instances of $1 in the script are already surrounded by quotes.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.