Dear Maintainer,
this is my fist bugreport for debian, so if I make some stupid mistake feel free to tell me
but don't be mad :-)
Sometimes when calling whereami from a /etc/pm/sleep.d/ hook whereami sets the wrong permissions
for the statefiles /var/lib/whereami/iam and iwas[.x]
This doesn't happen when calling it via sudo or logging in as root.
The perl documentation (at least as far as I can tell)
states nothing on file permissions when calling open() or rename()
so a chmod after the rename and open calls sets the correct file permissions in all circumstances.
The included patch fixes this problem (at least for me)
Sincerely, Hannes Franke
*** downloads/whereami_perms.patch
*** whereami 2015-04-23 19:50:21.461293703 +0200
--- /usr/sbin/whereami 2015-04-23 19:52:21.688811769 +0200
***************
*** 90,95 ****
--- 90,97 ----
close LASTLOCN;
chop $last_locations;
};
+ # fix permissions which may have been set wrong by open()
+ chmod 0644, "$statedir/iam";
}
print "Last: $last_locations\n" if ( $debug );
***************
*** 302,310 ****
--- 304,316 ----
# Rotate saved 'where we were' files.
for ( my $i=5; $i >= 0; $i-- ) {
rename "$statedir/iwas.$i", "$statedir/iwas." . ($i + 1);
+ # sometimes the files have incorrect permissions
+ chmod 0644, "$statedir/iwas." . ($i + 1);
}
rename "$statedir/iwas", "$statedir/iwas.0";
+ chmod 0644, "$statedir/iwas.0";
rename "$statedir/iam", "$statedir/iwas";
+ chmod 0644, "$statedir/iwas";
# Write file of these locations for next time...
open ( LASTLOCN, "> $statedir/iam" ) && do {
***************
*** 313,318 ****
--- 319,325 ----
}
close LASTLOCN;
};
+ chmod 0644, "$statedir/iam"
}
#############################################################