Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"wekan.database-list-backups" command is broken #26

Closed
WaryWolf opened this issue Jan 31, 2018 · 0 comments
Closed

"wekan.database-list-backups" command is broken #26

WaryWolf opened this issue Jan 31, 2018 · 0 comments

Comments

@WaryWolf
Copy link

Hi,

The snap command to list backups uses an asterisk (*) to attempt to list all files in a directory, which is a feature of some shells, known as file globbing - more info here: http://wiki.bash-hackers.org/syntax/expansion/globs

However this command is run directly and not passed through a shell, so the called executable looks for a file with the literal name of "*", and fails - as can be seen if you check the command with strace:

lstat("/var/snap/wekan/common/db-backups/*", 0x140b690) = -1 ENOENT (No such file or directory)

I did a quick test with a file named "*", which was picked up by the command:

root@wekan:/var/snap/wekan/common/db-backups# python
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open('*', 'w')
>>> f.write("hey hey")
>>> f.close()
>>> exit()

root@wekan:/var/snap/wekan/common/db-backups# ls -lah
total 920K
drwxrwxrwx 2 root root  131 Jan 31 13:30 .
drwxr-xr-x 5 root root 8.0K Jan 31 13:23 ..
-rw-r--r-- 1 root root    7 Jan 31 13:30 *
-rw-r--r-- 1 root root 281K Jan 29 16:59 wekan-20180129T165611.backup
-rw-r--r-- 1 root root 306K Jan 30 14:50 wekan-20180130T145015.backup
-rw-r--r-- 1 root root 309K Jan 31 03:00 wekan-20180131T030001.backup

root@wekan:/var/snap/wekan/common/db-backups# wekan.database-list-backups 
-rw-r--r-- 1 root root 7 Jan 31 13:30 /var/snap/wekan/common/db-backups/*

Obviously, this is not the intended behaviour. I haven't had a chance to test it yet, but I believe changing the database-list-backups command to use ls -al $SNAP_COMMON/db-backups/ instead of ls -ald $SNAP_COMMON/db-backups/* should work. the -d flag is unnecessary since backups are files, not directories.

This testing was done on a Ubuntu 16.04.3 VM, with snapd version 2.29.4.2, if that makes a difference.

Regards, Anthony.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant