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

Kunsi fix restores #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/restore-fuse-mounts.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/perl -W

use strict;
use CRS::Fuse::VDV;
use CRS::Fuse::TS;
use CRS::Tracker::Client;
use boolean;

Expand Down Expand Up @@ -61,7 +63,7 @@
my $fuse = CRS::Fuse->new($props) or die 'Fuse lib is missing';
my $mntpath = $fuse->getMountPath($vid) or die 'Cannot get mount path';
print " creating directory '$mntpath' \n";
qx / mkdir -p "$mntpath" / or die 'Cannot create mount directory';
qx / mkdir -p "$mntpath" /;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this error check means you will execute a command on an either non-existing directory or one with very likely wrong permissions. I really think that there should be at least a bail-out from the current loop iteration. Alternatively it could be checked if the directory already exists and is writable, which would be a situation where this could work without write access to the parent directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are correct. After having thought about the problem i found the real issue. We run this script as user voc, but fuse-ts creates the mounts as root. If the mounts vanish, the mount directories are owned by root, thus mkdir -p fails. The hackaround is to run chown -R prior to running the script, but that does not seem like the best solution.

I will think about how we can solve this after camp.

Are you willing to cherry-pick the other commit, or should i create a new PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!


print " executing '$cmd'\n";
qx / $cmd /;
Expand Down