Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Pacman Development (http://www.linux-archive.org/archlinux-pacman-development/)
-   -   repo-add: don't create links if archive extension is invalid (http://www.linux-archive.org/archlinux-pacman-development/542670-repo-add-dont-create-links-if-archive-extension-invalid.html)

Allan McRae 06-22-2011 08:09 AM

repo-add: don't create links if archive extension is invalid
 
On 21/06/11 02:19, Dan McGee wrote:

Not sure what to do here, if we should be proceeding at all. The current
situation:

dmcgee@galway ~/projects/pacman (master)
$ ./scripts/repo-add /tmp/invalid.xxx /var/cache/pacman/pkg/apr-1.4.5-1-x86_64.pkg.tar.xz
==> Adding package '/var/cache/pacman/pkg/apr-1.4.5-1-x86_64.pkg.tar.xz'
-> Computing checksums...
-> Creating 'desc' db entry...
-> Creating 'depends' db entry...
==> Creating updated database file '/tmp/invalid.xxx'
==> WARNING: '/tmp/invalid.xxx' does not have a valid archive extension.

dmcgee@galway ~/projects/pacman (master)
$ ll /tmp/invalid.xxx
lrwxrwxrwx 1 dmcgee users 11 Jun 20 11:08 /tmp/invalid.xxx -> invalid.xxx

So we get a symlink to ourself, and overwrite the originally generated
repo database. This patch prevents this behavior, and writes out a
non-compressed database to invalid.xxx and generates no links.

Thoughts? Pacman has a requirement that the db file end in '.db', and
the only other extension out there in the wild is '.files' as far as I
know. Should we have strict enforcement of one of these two types in
repo-add? Doing this could also make the --files flag a bit less
necessary as one could auto-detect the correct setting based on the DB
extension.


Given the requirement for a .db extension, how about just creating
"invalid.xxx.db" and assuming that no compression is wanted and that is
the name of the repo?


if [[ $dblink == $REPO_DB_FILE ]]; then
dblink="${REPO_DB_FILE}.db
fi

Allan


All times are GMT. The time now is 07:14 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.