Package: apt
Version: 2.0.2ubuntu0.1 

Current output:

$ apt-get update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission 
denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: 
Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches 
(13: Permission denied)


Expected output:

$ apt-get update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock not running as root - open 
Permission denied
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission 
denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: 
Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches 
(13: Permission denied)


it's easy enough to check uid is 0 by calling getuid()

There's no real reason to show the errno value 13, we don't all know these by 
heart. you could put EPERM if you wish to use the macro name

Reply via email to