Bug#565436: pbuilder: new $HOME value broke my hook scripts

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug#565436: pbuilder: new $HOME value broke my hook scripts

Francesco Poli (t1000)
Package: pbuilder
Version: 0.196
Severity: normal

Hi!

The recent change in the $HOME value set by pdebuild-internal
(see commit 88e0052c7362c2c2a7841579f007ccabeae27c49 ) broke most of
my hook scripts, since they unfortunately rely on the fact that $HOME
ends with "/../"

Would it be possible to add a new environment variable to identify the
debianized source directory?

I think that adding the following simple line in pdebuild-internal just
before    export HOME=$(readlink -f $(pwd)/../)
would suffice:

  export DEBSOURCEDIR=$(readlink -f $(pwd))

maybe with a comment that explains that this is useful for
hook scripts.


I think this would be harmless and very useful for many hook
scripts written by users in the future.
Please add this line as soon as possible, if you agree.

Thanks for your time.



-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (800, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages pbuilder depends on:
ii  cdebootstrap                  0.5.5      Bootstrap a Debian system
ii  coreutils                     7.4-2      The GNU core utilities
ii  debconf [debconf-2.0]         1.5.28     Debian configuration management sy
ii  debianutils                   3.2.2      Miscellaneous utilities specific t
ii  wget                          1.12-1.1   retrieves files from the web

Versions of packages pbuilder recommends:
ii  devscripts                    2.10.61    scripts to make the life of a Debi
ii  fakeroot                      1.14.4-1   Gives a fake root environment
ii  sudo                          1.7.2p1-1  Provide limited super user privile

Versions of packages pbuilder suggests:
pn  cowdancer                     <none>     (no description available)
pn  gdebi-core                    <none>     (no description available)
pn  pbuilder-uml                  <none>     (no description available)

-- debconf information excluded



--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Bug#565436: pbuilder: new $HOME value broke my hook scripts

Loïc Minier-3
severity 565436 wishlist
tag 565436 + patch
retitle 565436 PATH to Debian source in env var
stop

        Hi

On Fri, Jan 15, 2010, Francesco Poli (t1000) wrote:

> Would it be possible to add a new environment variable to identify the
> debianized source directory?
>
> I think that adding the following simple line in pdebuild-internal just
> before    export HOME=$(readlink -f $(pwd)/../)
> would suffice:
>
>   export DEBSOURCEDIR=$(readlink -f $(pwd))
>
> maybe with a comment that explains that this is useful for
> hook scripts.
>
> I think this would be harmless and very useful for many hook
> scripts written by users in the future.
> Please add this line as soon as possible, if you agree.

 Sure; that seems fine; not sure about the actual name, but that would
 work.

 The other hooks around do things like:
    cd /tmp/buildd/*/debian/..

 Which is probably a good workaround for your hooks for now.

--
Loïc Minier



--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Bug#565436: pbuilder: new $HOME value broke my hook scripts

Francesco Poli (t1000)
On Fri, 15 Jan 2010 21:15:14 +0100 Loïc Minier wrote:

[...]

> On Fri, Jan 15, 2010, Francesco Poli (t1000) wrote:
> > Would it be possible to add a new environment variable to identify the
> > debianized source directory?
> >
> > I think that adding the following simple line in pdebuild-internal just
> > before    export HOME=$(readlink -f $(pwd)/../)
> > would suffice:
> >
> >   export DEBSOURCEDIR=$(readlink -f $(pwd))
> >
> > maybe with a comment that explains that this is useful for
> > hook scripts.
> >
> > I think this would be harmless and very useful for many hook
> > scripts written by users in the future.
> > Please add this line as soon as possible, if you agree.
>
>  Sure; that seems fine; not sure about the actual name, but that would
>  work.
Thank you very much for your quick and positive response!  :-)
I hope it can be done soon.

>
>  The other hooks around do things like:
>     cd /tmp/buildd/*/debian/..

Take into account that we are talking about pdebuild-internal, hence
the debianized source directory will be something like
/home/myuser/mypath/to/debpackages/mydebpackage/mydebpackage-x.y.z-r

Or am I misunderstanding something?

Maybe something like

  cd ${HOME}/*/debian/..

could help in my case.

>
>  Which is probably a good workaround for your hooks for now.

I was indeed planning to use a workaround like the one described above,
but it has a flaw: it breaks if I keep more than one debianized
source directory inside the same parent directory, as in

..
└── bigproject
    ├── first_package
    │   └── debian
    ├── second_package
    │   └── debian
    └── third_package
        └── debian

where the workaround will always drop me into the first directory of
the file globbing expansion (the other non-optional arguments are
ignored by the cd command).

Rationale for this directory structure: two or more source packages may
be related, e.g. a program and some libraries used by the program


P.S.: the hook scripts I was talking about are the ones mentioned in
my .signature ...

--
 http://www.inventati.org/frx/progs/scripts/pdebuild-hooks.html
 Need some pdebuild hook scripts?
..................................................... Francesco Poli .
 GnuPG key fpr == C979 F34B 27CE 5CD8 DC12  31B5 78F4 279B DD6D FCF4

attachment0 (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#565436: pbuilder: new $HOME value broke my hook scripts

Francesco Poli (t1000)
On Fri, 15 Jan 2010 22:35:41 +0100 Francesco Poli wrote:

> On Fri, 15 Jan 2010 21:15:14 +0100 Loïc Minier wrote:
>
> [...]
> > On Fri, Jan 15, 2010, Francesco Poli (t1000) wrote:
> > > Would it be possible to add a new environment variable to identify the
> > > debianized source directory?
> > >
> > > I think that adding the following simple line in pdebuild-internal just
> > > before    export HOME=$(readlink -f $(pwd)/../)
> > > would suffice:
> > >
> > >   export DEBSOURCEDIR=$(readlink -f $(pwd))
> > >
> > > maybe with a comment that explains that this is useful for
> > > hook scripts.
[...]

> Maybe something like
>
>   cd ${HOME}/*/debian/..
>
> could help in my case.
>
> >
> >  Which is probably a good workaround for your hooks for now.
>
> I was indeed planning to use a workaround like the one described above,
> but it has a flaw: it breaks if I keep more than one debianized
> source directory inside the same parent directory
[...]

I've updated my hook scripts with a workaround similar to the one
described above (see the web page on my .signature).
They suffer from the limitation I explained: I cannot place two
debianized source directories side by side.

Loïc, did you find the time to add the DEBSOURCEDIR environment
variable?
I still think it would be very useful.


--
 http://www.inventati.org/frx/progs/scripts/pdebuild-hooks.html
 Need some pdebuild hook scripts?
..................................................... Francesco Poli .
 GnuPG key fpr == C979 F34B 27CE 5CD8 DC12  31B5 78F4 279B DD6D FCF4

attachment0 (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#565436: pbuilder: new $HOME value broke my hook scripts

Junichi Uekawa
In reply to this post by Loïc Minier-3
At Fri, 15 Jan 2010 21:15:14 +0100,
Loïc Minier wrote:

>
> severity 565436 wishlist
> tag 565436 + patch
> retitle 565436 PATH to Debian source in env var
> stop
>
>         Hi
>
> On Fri, Jan 15, 2010, Francesco Poli (t1000) wrote:
> > Would it be possible to add a new environment variable to identify the
> > debianized source directory?
> >
> > I think that adding the following simple line in pdebuild-internal just
> > before    export HOME=$(readlink -f $(pwd)/../)
> > would suffice:
> >
> >   export DEBSOURCEDIR=$(readlink -f $(pwd))
> >
> > maybe with a comment that explains that this is useful for
> > hook scripts.
> >
> > I think this would be harmless and very useful for many hook
> > scripts written by users in the future.
> > Please add this line as soon as possible, if you agree.
>
>  Sure; that seems fine; not sure about the actual name, but that would
>  work.
>
>  The other hooks around do things like:
>     cd /tmp/buildd/*/debian/..
>
>  Which is probably a good workaround for your hooks for now.

We probably need to export a env var to the source tree, since that
doesn't always work, and relying on that is a bit flaky.





--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Bug#565436: closed by Mattia Rizzolo <mattia@mapreri.org> (Re: Bug#565436: pbuilder: new $HOME value broke my hook scripts)

Francesco Poli (wintermute)
In reply to this post by Francesco Poli (t1000)
Control: found -1 0.216


On Thu, 15 Oct 2015 14:26:55 +0000 Mattia Rizzolo wrote:

[...]

Hello Mattia,
thanks for dedicating some time to my bug report!   :-)


> On Fri, Jan 15, 2010 at 07:50:51PM +0100, Francesco Poli (t1000) wrote:
> > The recent change in the $HOME value set by pdebuild-internal
> > (see commit 88e0052c7362c2c2a7841579f007ccabeae27c49 ) broke most of
> > my hook scripts, since they unfortunately rely on the fact that $HOME
> > ends with "/../"
>
> That's a crazy assumption :)

I know, but I was trying to work around the absence of an environment
variable for the debianized source directory!

>
> > Would it be possible to add a new environment variable to identify the
> > debianized source directory?
>
> Well, pbuilder does not know it.

We are _not_ talking about pbuilder, we are talking about pdebuild !
Please re-read the initial bug report !

> all pbuilder knows is where the sources are copied and the name of the
> .dsc, then everything is up to the gods.
> So, since 0.216 there is a BUILDDIR variable that is also accessible by
> hooks.  From there you can most probably reach the actual sources by
>
> ${BUILDDIR}/*/debian/../

BUILDDIR may be useful for users who invoke "pbuilder build ...".

I usually invoke "pdebuild ...", so I would need you to modify
pdebuild-internal, as requested in the original bug report:
just before

  export HOME=$(readlink -f $(pwd)/../)

please add

  export DEBSOURCEDIR=$(readlink -f $(pwd))

maybe with a check (in case of failure) and with a comment that
explains that this is useful for hook scripts.

[...]
> There you are, if you need more please open a new bug.

I would rather reopen this bug report, since the requested feature has
not yet been implemented...

Please let me know whether anything in my reasoning is flawed.
Thanks for your time and patience.

Bye.

--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

attachment0 (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#565436: closed by Mattia Rizzolo <mattia@mapreri.org> (Re: Bug#565436: pbuilder: new $HOME value broke my hook scripts)

Mattia Rizzolo-4
control: retitle -1 PATH to Debian source in env a var within pdebuild-internal

On Fri, Oct 16, 2015 at 12:20:07AM +0200, Francesco Poli wrote:
> On Thu, 15 Oct 2015 14:26:55 +0000 Mattia Rizzolo wrote:
> > On Fri, Jan 15, 2010 at 07:50:51PM +0100, Francesco Poli (t1000) wrote:
> > > Would it be possible to add a new environment variable to identify the
> > > debianized source directory?
> >
> > Well, pbuilder does not know it.
>
> We are _not_ talking about pbuilder, we are talking about pdebuild !
> Please re-read the initial bug report !

crap.

I mis(user)tagged this bug the first time I read it, and when today I
replied to it I only looked at the title, just thinking about my tag :\

sorry for that...

> BUILDDIR may be useful for users who invoke "pbuilder build ...".
>
> I usually invoke "pdebuild ...", so I would need you to modify
> pdebuild-internal, as requested in the original bug report:
> just before
>
>   export HOME=$(readlink -f $(pwd)/../)
>
> please add
>
>   export DEBSOURCEDIR=$(readlink -f $(pwd))
I don't use pdebuild-internal myself, and I'd really prefer to
read&understand the whole thing before trying to touch it :)
That means I need a bit more time!

> > There you are, if you need more please open a new bug.
>
> I would rather reopen this bug report, since the requested feature has
> not yet been implemented...

yeah, sorry :|

> Please let me know whether anything in my reasoning is flawed.
> Thanks for your time and patience.

Sorry again for stealing from you time to read and fix my flaws,
instead!
I'll come back once I get what this pdebuild-internal thing is about :)

--
regards,
                        Mattia Rizzolo

GPG Key: 66AE 2B4A FCCF 3F52 DA18  4D18 4B04 3FCD B944 4540      .''`.
more about me:  http://mapreri.org                              : :'  :
Launchpad user: https://launchpad.net/~mapreri                  `. `'`
Debian QA page: https://qa.debian.org/developer.php?login=mattia  `-

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#565436: closed by Mattia Rizzolo <mattia@mapreri.org> (Re: Bug#565436: pbuilder: new $HOME value broke my hook scripts)

Francesco Poli (wintermute)
On Fri, 16 Oct 2015 00:05:56 +0000 Mattia Rizzolo wrote:

[...]
> On Fri, Oct 16, 2015 at 12:20:07AM +0200, Francesco Poli wrote:
[...]
> > We are _not_ talking about pbuilder, we are talking about pdebuild !
> > Please re-read the initial bug report !
>
> crap.
>
> I mis(user)tagged this bug the first time I read it, and when today I
> replied to it I only looked at the title, just thinking about my tag :\
>
> sorry for that...

Don't worry!

[...]

> > I usually invoke "pdebuild ...", so I would need you to modify
> > pdebuild-internal, as requested in the original bug report:
> > just before
> >
> >   export HOME=$(readlink -f $(pwd)/../)
> >
> > please add
> >
> >   export DEBSOURCEDIR=$(readlink -f $(pwd))
>
> I don't use pdebuild-internal myself, and I'd really prefer to
> read&understand the whole thing before trying to touch it :)
> That means I need a bit more time!
Totally understandable: before modifying things, I would also want to
take a look at them and get an idea of how they work.

Although, in this case, just defining and exporting one additional
environment variable should probably have little chance to break
things...

[...]
> > Please let me know whether anything in my reasoning is flawed.
> > Thanks for your time and patience.
>
> Sorry again for stealing from you time to read and fix my flaws,
> instead!
> I'll come back once I get what this pdebuild-internal thing is about :)

No problem!

Thanks for adopting pbuilder and for your effort to fix its bugs,
instead!   :-)


--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

attachment0 (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#565436: closed by Mattia Rizzolo <mattia@mapreri.org> (Re: Bug#565436: pbuilder: new $HOME value broke my hook scripts)

Francesco Poli (wintermute)
On Fri, 16 Oct 2015 19:30:49 +0200 Francesco Poli wrote:

[...]
> Although, in this case, just defining and exporting one additional
> environment variable should probably have little chance to break
> things...
[...]

Is there any progress on bug [#565436]?

[#565436]: <https://bugs.debian.org/565436>

Please add this harmless line to /usr/lib/pbuilder/pdebuild-internal:

  export DEBSOURCEDIR=$(readlink -f $(pwd))

This patch has been sitting here for more than 9 years!
Don't you think it's time to make this trivial modification and thus
close this bug report?

Thanks for your time.
Bye.


--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#565436: closed by Mattia Rizzolo <mattia@mapreri.org> (Re: Bug#565436: pbuilder: new $HOME value broke my hook scripts)

Thorsten Glaser
Francesco Poli dixit:

>Please add this harmless line to /usr/lib/pbuilder/pdebuild-internal:
>
>  export DEBSOURCEDIR=$(readlink -f $(pwd))

Harmful. You’ll want:

    DEBSOURCEDIR=$(readlink -f "$(pwd)"); export DEBSOURCEDIR


bye,
//mirabilos
--
FWIW, I'm quite impressed with mksh interactively. I thought it was much
*much* more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider it for my daily use if I hadn't
wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh

Reply | Threaded
Open this post in threaded view
|

Bug#565436: closed by Mattia Rizzolo <mattia@mapreri.org> (Re: Bug#565436: pbuilder: new $HOME value broke my hook scripts)

Francesco Poli (wintermute)
On Sun, 7 Jul 2019 21:13:28 +0000 (UTC) Thorsten Glaser wrote:

> Francesco Poli dixit:
>
> >Please add this harmless line to /usr/lib/pbuilder/pdebuild-internal:
> >
> >  export DEBSOURCEDIR=$(readlink -f $(pwd))
>
> Harmful. You’ll want:
>
>     DEBSOURCEDIR=$(readlink -f "$(pwd)"); export DEBSOURCEDIR

Why harmful?
Because it is a bashism?
I agree that it is a bashism, but:

  $ head -n 1 /usr/lib/pbuilder/pdebuild-internal
  #! /bin/bash

hence, it should be OK anyway.
Please note that there already is a:

  export HOME=$(readlink -f $(pwd)/../)
  if [ -z "${HOME}" ]; then
      echo "E: Failed to obtain reasonable HOME from pwd"
  fi


Or am I misunderstanding your comment?



--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#565436: closed by Mattia Rizzolo <mattia@mapreri.org> (Re: Bug#565436: pbuilder: new $HOME value broke my hook scripts)

Thorsten Glaser
Francesco Poli dixit:

>Why harmful?

Underquoting.

>Because it is a bashism?

The “export a=b” is, sure, but…

>Please note that there already is a:
>
>  export HOME=$(readlink -f $(pwd)/../)

… this can explode (if $PWD contains a space).
Just fix it as well.

bye,
//mirabilos
--
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
        -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

Reply | Threaded
Open this post in threaded view
|

Bug#565436: closed by Mattia Rizzolo <mattia@mapreri.org> (Re: Bug#565436: pbuilder: new $HOME value broke my hook scripts)

Francesco Poli (wintermute)
On Sun, 7 Jul 2019 21:33:51 +0000 (UTC) Thorsten Glaser wrote:

> Francesco Poli dixit:
>
> >Why harmful?
>
> Underquoting.
>
> >Because it is a bashism?
>
> The “export a=b” is, sure, but…
>
> >Please note that there already is a:
> >
> >  export HOME=$(readlink -f $(pwd)/../)
>
> … this can explode (if $PWD contains a space).
> Just fix it as well.
Ah, you're right, I hadn't noticed the added quotes...

Thanks for improving the line I would love to see added to
pdebuild-internal!


--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

attachment0 (849 bytes) Download Attachment