FS#14751 - [makepkg] warn about $startdir references

Attached to Project: Pacman
Opened by Sergej Pupykin (sergej) - Monday, 18 May 2009, 16:10 GMT
Last edited by Allan McRae (Allan) - Monday, 14 December 2009, 05:54 GMT
Task Type Feature Request
Category makepkg
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version 3.2.2
Due in Version 3.4.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

There are many bugs in packages such as wrong path in script or insecure RPATH in .so.

I suggest patch for makepkg command which grep all package files for $startdir and warn user about every matched file.

I see may be this task is for namcap, but namcap does not know $startdir value.

Here is output example (see 'WARNING:' line):

==> Making package: foo 1-1 any (Пнд Май 18 20:09:30 MSD 2009)
==> Checking Runtime Dependencies...
==> Checking Buildtime Dependencies...
==> Retrieving Sources...
==> Validating source files with md5sums...
==> Extracting Sources...
==> Removing existing pkg/ directory...
==> Entering fakeroot environment...
==> Starting build()...
==> Tidying install...
-> Compressing man pages...
-> Stripping debugging symbols from binaries and libraries...
==> Checking for $startdir references...
==> WARNING: File /home/sergej/aur/makepkg/pkg/test.txt contain $startdir reference!
==> Creating package...
-> Generating .PKGINFO file...
-> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: foo 1-1 any (Пнд Май 18 20:09:32 MSD 2009)
This task depends upon

Closed by  Allan McRae (Allan)
Monday, 14 December 2009, 05:54 GMT
Reason for closing:  Fixed
Additional comments about closing:  git commit b805fe58
Comment by Sergej Pupykin (sergej) - Monday, 18 May 2009, 16:12 GMT
here is directory which contains test PKGBUILD and modified makepkg command
Comment by Allan McRae (Allan) - Wednesday, 20 May 2009, 10:48 GMT
A couple of comments. We need to search for $srcdir as it is not guaranteed that $srcdir and $startdir are related. It also needs to only check in those files installed to $pkgdir, so should be done after we do the "cd $pkgdir".

Note that insecure RPATH is scheduled to be detected in namcap at some stage. I would really prefer makepkg to only be a package maker and namcap to be the the checker, but I can not see this check being able to be implemented in namcap.
Comment by Sergej Pupykin (sergej) - Wednesday, 20 May 2009, 12:50 GMT
I think ideal solution is ability to run namcap from makepkg before package compression and make it optdepends of makepkg.

It avoids unneeded packing/unpacking saving time, $srcdir can be passed to namcap from makepkg, makepkg just builds packages.
Comment by Sergej Pupykin (sergej) - Thursday, 09 July 2009, 14:50 GMT
I patch namcap to make it check directories

http://arch.pp.ru/~sergej/files/namcap/0001-parse-directory.patch.gz

With this patch, you can

namcap /home/sergej/distr.rcs/namcap.git/pkg/

path MUST be absolute and MUST end with /

I found only one issue - it prints messages about wrong owner uid/gid

(Path implements dirfile module, which is compatible with tarfile module)

I hope it helps to integrate namcap into makepkg as plugin
Comment by Sergej Pupykin (sergej) - Thursday, 09 July 2009, 14:55 GMT
*(Patch implements dirfile module, which is compatible with tarfile module)

it have not all tarfile classes and methods, but enough for modules working
Comment by Sergej Pupykin (sergej) - Friday, 10 July 2009, 09:33 GMT
To avoid messages about invalid owner you should run inside fakeroot

0002 patch changes:
- cleanups
- file uid/gid fix
- relative path can be used
- dir may not ends with /

I attach these patches

It is quite dirty now, but I think it is already usable
Comment by Sergej Pupykin (sergej) - Friday, 10 July 2009, 09:35 GMT
usage example:

$ fakeroot ./namcap.py pkg
archlinux-xdg-menu W: Dependency included and not needed ('perlxml')
archlinux-xdg-menu W: File (var/cache) exists in a non-standard directory.
archlinux-xdg-menu W: File (var/cache/xdg-menu) exists in a non-standard directory.

$ fakeroot ./namcap.py archlinux-xdg-menu-0.7.4-1.pkg.tar.gz
archlinux-xdg-menu W: Dependency included and not needed ('perlxml')
archlinux-xdg-menu W: File (var/cache) exists in a non-standard directory.
archlinux-xdg-menu W: File (var/cache/xdg-menu) exists in a non-standard directory.
Comment by Allan McRae (Allan) - Saturday, 24 October 2009, 14:57 GMT

Loading...