FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian dpkg

 
 
LinkBack Thread Tools
 
Old 04-18-2011, 11:41 AM
Daniel Lobato
 
Default Installing packages with a diverted hardlink

Hi everyone! I am introducing myself to dpkg development and I am
starting by trying to solve a bug, Steve Langasek purposed me to solve
this old one http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=245322

Basically the problem here is that once you have diverted the file
(created with dpkg-divert /sbin/mkreiserfs in this particular case),
dpkg is unable to unpack the package. I've been taking a look at the
code at git://git.debian.org/git/dpkg/dpkg.git and I found that the
error happens in

"src/archives.c"
error creating hardlink
- its a case in a switch
case tar_filetype_hardlink


So I've thought a workaround for this:

> Dpkg could execute the command dpkg-divert --list | grep "thefile" and
> if the file has been diverted, install it in the diverted location.
> Problems? The only way that I know to save the output of that would be
> by means of >, dpkg-divert --list | grep "thefile" > afiletolookin.
> The main problem here would be that doing this for every single
> package would result in a slower installation and hence in a worse
> user experience, as creating a file , looking in it and deleting it is
> a more or less 'costly' process.

Unfortunately Steve told me that this is not feasible as dpkg should
never call dpkg-divert; dpkg already has complete information about
diverted files internally.
He told me to take a look at the data structures within the dpkg code
in order to find the information that dpkg is using currently to
unpack the packages to diverted
locations.

So, after writing this long mail my question is.. if I cannot use
dpkg-divert, where can I find in the code the information about what
is doing dpkg when unpacking the packages to diverted locations? To
solve this bug would be as simple as to look where is the diversion
pointing to and unpack the package there, but it is a bit difficult to
search for it in the code. So far I have been examining divertcmd.c,
archives.c, errors.c with no avail. Any clues?

Thank you guys!


--
To UNSUBSCRIBE, email to debian-dpkg-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: BANLkTim+QKUF-cFFch3okmZ8Z5KoydsE6g@mail.gmail.com">http://lists.debian.org/BANLkTim+QKUF-cFFch3okmZ8Z5KoydsE6g@mail.gmail.com
 
Old 04-18-2011, 04:35 PM
Guillem Jover
 
Default Installing packages with a diverted hardlink

Hi!

On Mon, 2011-04-18 at 13:41:32 +0200, Daniel Lobato wrote:
> Hi everyone! I am introducing myself to dpkg development and I am
> starting by trying to solve a bug, Steve Langasek purposed me to solve
> this old one http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=245322
>
> Basically the problem here is that once you have diverted the file
> (created with dpkg-divert /sbin/mkreiserfs in this particular case),
> dpkg is unable to unpack the package. I've been taking a look at the
> code at git://git.debian.org/git/dpkg/dpkg.git and I found that the
> error happens in
>
> "src/archives.c"
> error creating hardlink
> - its a case in a switch
> case tar_filetype_hardlink

You might want to provide a minimal test case for our functional test
suite at:

<http://git.debian.org/?p=dpkg/pkg-tests.git>

> So I've thought a workaround for this:
>
> > Dpkg could execute the command dpkg-divert --list | grep "thefile" and
> > if the file has been diverted, install it in the diverted location.
> > Problems? The only way that I know to save the output of that would be
> > by means of >, dpkg-divert --list | grep "thefile" > afiletolookin.
> > The main problem here would be that doing this for every single
> > package would result in a slower installation and hence in a worse
> > user experience, as creating a file , looking in it and deleting it is
> > a more or less 'costly' process.
>
> Unfortunately Steve told me that this is not feasible as dpkg should
> never call dpkg-divert; dpkg already has complete information about
> diverted files internally.

Well it would be feasible, but it would be wrong.

> He told me to take a look at the data structures within the dpkg code
> in order to find the information that dpkg is using currently to
> unpack the packages to diverted
> locations.

Right.

> So, after writing this long mail my question is.. if I cannot use
> dpkg-divert, where can I find in the code the information about what
> is doing dpkg when unpacking the packages to diverted locations? To
> solve this bug would be as simple as to look where is the diversion
> pointing to and unpack the package there, but it is a bit difficult to
> search for it in the code. So far I have been examining divertcmd.c,
> archives.c, errors.c with no avail. Any clues?

Check from src/filesdb.h “struct diversion”, src/help.c:namenodetouse()
and src/divertdb.c:ensure_diversions(). That should give you a start I
guess.

After skimming over the code, I think the fix is trivial, although
I've not verified this at all. So I'll let you guys to it.

regards,
guillem


--
To UNSUBSCRIBE, email to debian-dpkg-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110418163545.GB16187@gaara.hadrons.org">http://lists.debian.org/20110418163545.GB16187@gaara.hadrons.org
 

Thread Tools




All times are GMT. The time now is 09:39 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org