Package: whereami
Version: 0.3.34-0.3
Severity: normal
Tags: patch

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"
  }
  
  #############################################################


-- System Information:
Debian Release: 8.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages whereami depends on:
ii  iputils-ping                   3:20121221-5+b2
ii  isc-dhcp-client [dhcp-client]  4.3.1-6
ii  netbase                        5.3
ii  perl                           5.20.2-3

Versions of packages whereami recommends:
ii  iputils-arping  3:20121221-5+b2
ii  resolvconf      1.76.1
ii  wireless-tools  30~pre9-8

Versions of packages whereami suggests:
ii  ethtool       1:3.16-1
pn  fping         <none>
pn  ifplugd       <none>
ii  net-tools     1.60-26+b1
pn  pcmcia-cs     <none>
pn  squid | oops  <none>

-- Configuration Files:
/etc/dhcp/dhclient-exit-hooks.d/whereami changed [not included]
/etc/whereami/detect.conf changed [not included]
/etc/whereami/whereami.conf changed [not included]

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to