From 16c0f50ed6826cd064510101c60ba98a582759dd Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Mon, 11 Oct 1999 02:11:58 +0000 Subject: [PATCH] Fix dpkg-deb to be able to handle archives made with Linux ar --- ChangeLog | 5 +++++ dpkg-deb/dpkg-deb.h | 6 ++++-- dpkg-deb/extract.c | 9 ++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10c78bae..74b95a1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 11 02:13:15 CEST 1999 Wichert Akkerman + + * Merge patch from Ben Collins to make dpkg-deb + handle packages created with Linux ar. + Thu Oct 7 01:16:23 CEST 1999 Wichert Akkerman * Check if codenumber is between 0 and 99 instead of just checking diff --git a/dpkg-deb/dpkg-deb.h b/dpkg-deb/dpkg-deb.h index 946e823c..e48e29e2 100644 --- a/dpkg-deb/dpkg-deb.h +++ b/dpkg-deb/dpkg-deb.h @@ -34,7 +34,9 @@ void extracthalf(const char *debar, const char *directory, const char *taroption, int admininfo); #define DEBMAGIC "!\ndebian-binary " -#define ADMINMEMBER "control.tar.gz " -#define DATAMEMBER "data.tar.gz " +#define ADMINMEMBER "control.tar.gz " +#define ADMINMEMBER_COMPAT "control.tar.gz/ " +#define DATAMEMBER "data.tar.gz " +#define DATAMEMBER_COMPAT "data.tar.gz/ " #endif /* DPKG_DEB_H */ diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c index 7f080a8d..b063bf0d 100644 --- a/dpkg-deb/extract.c +++ b/dpkg-deb/extract.c @@ -125,7 +125,8 @@ void extracthalf(const char *debar, const char *directory, if (memberlen<0) ohshit(_("file `%.250s' is corrupt - negative member length %ld"),debar,memberlen); if (!header_done) { - if (memcmp(arh.ar_name,"debian-binary ",sizeof(arh.ar_name))) + if (memcmp(arh.ar_name,"debian-binary ",sizeof(arh.ar_name)) && + memcmp(arh.ar_name,"debian-binary/ ",sizeof(arh.ar_name))) ohshit(_("file `%.250s' is not a debian binary archive (try dpkg-split?)"),debar); infobuf= m_malloc(memberlen+1); if (fread(infobuf,1, memberlen + (memberlen&1), ar) != memberlen + (memberlen&1)) @@ -150,8 +151,10 @@ void extracthalf(const char *debar, const char *directory, skipmember(ar,debar,memberlen); } else { adminmember= - !memcmp(arh.ar_name,ADMINMEMBER,sizeof(arh.ar_name)) ? 1 : - !memcmp(arh.ar_name,DATAMEMBER,sizeof(arh.ar_name)) ? 0 : + (!memcmp(arh.ar_name,ADMINMEMBER,sizeof(arh.ar_name)) || + !memcmp(arh.ar_name,ADMINMEMBER_COMPAT,sizeof(arh.ar_name))) ? 1 : + (!memcmp(arh.ar_name,DATAMEMBER,sizeof(arh.ar_name)) || + !memcmp(arh.ar_name,DATAMEMBER_COMPAT,sizeof(arh.ar_name))) ? 0 : -1; if (adminmember == -1) { ohshit(_("file `%.250s' contains ununderstood data member %.*s, giving up"), -- 2.39.5