Skip Menu |

This queue is for tickets about the Sys-Hostname-Long CPAN distribution.

Report information
The Basics
Id: 19932
Status: open
Priority: 0/
Queue: Sys-Hostname-Long

People
Owner: Nobody in particular
Requestors: JMEHNLE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 1.3
  • 1.4
Fixed in: (no value)



Subject: Should not be calling `su` (fails under fakeroot)
When $< (UID) is 0, Sys::Hostname::Long does `su nobody -c "hostname -- fqdn"`. Under fakeroot however (e.g. when building and testing packages), this makes `su` ask for a password because the process isn't _really_ running as root. Sys::Hostname::Long shouldn't be calling `su` in the first place!
Subject: Re: [rt.cpan.org #19932] Should not be calling `su` (fails under fakeroot)
Date: Sat, 17 Jun 2006 03:40:06 +0000 (UTC)
To: bug-Sys-Hostname-Long [...] rt.cpan.org
From: Scott Penrose <scottp [...] linux.dd.com.au>
----- Julian Mehnle via RT <bug-Sys-Hostname-Long@rt.cpan.org> wrote: Show quoted text
> Fri Jun 16 06:01:07 2006: Request 19932 was acted upon. > Transaction: Ticket created by JMEHNLE > Queue: Sys-Hostname-Long > Subject: Should not be calling `su` (fails under fakeroot) > Broken in: 1.3, 1.4 > Severity: Important > Owner: Nobody > Requestors: JMEHNLE@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=19932 > > > > When $< (UID) is 0, Sys::Hostname::Long does `su nobody -c "hostname > -- > fqdn"`. Under fakeroot however (e.g. when building and testing > packages), this makes `su` ask for a password because the process > isn't > _really_ running as root.
Ok I will review that. Show quoted text
> Sys::Hostname::Long shouldn't be calling `su` in the first place!
In an ideal world yes :-) But there are some operating systems out there wich just won't return unless we call "hostname" and if we don't change the user first, then in some operating systems it changes the hostname to "--fqdn". I do believe we could improve it, do more host type specific testing, and rely less on falling back to a sys call (which I really don't like either). Ta Scott
From: julian [...] mehnle.net
Show quoted text
> > Sys::Hostname::Long shouldn't be calling `su` in the first place!
> > In an ideal world yes :-) But there are some operating systems out > there wich just won't return unless we call "hostname" and if we > don't change the user first, then in some operating systems it > changes the hostname to "--fqdn". > > I do believe we could improve it, do more host type specific testing, > and rely less on falling back to a sys call (which I really don't > like either).
I think there are plenty other options. Take a look at what Sys::Hostname::FQDN and Net::Domain are doing. I know that portably getting the full hostname can be a pain in the ass, but there /really/ should be a better solution than `su nobody -c "hostname --fqdn"`.
Subject: Re: [rt.cpan.org #19932] Should not be calling `su` (fails under fakeroot)
Date: Sun, 18 Jun 2006 01:03:41 +0000 (UTC)
To: bug-Sys-Hostname-Long [...] rt.cpan.org
From: Scott Penrose <scottp [...] linux.dd.com.au>
----- Julian Mehnle via RT <bug-Sys-Hostname-Long@rt.cpan.org> wrote: Show quoted text
> Queue: Sys-Hostname-Long > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=19932 > >
> > > Sys::Hostname::Long shouldn't be calling `su` in the first place!
> > > > In an ideal world yes :-) But there are some operating systems out > > there wich just won't return unless we call "hostname" and if we > > don't change the user first, then in some operating systems it > > changes the hostname to "--fqdn". > > > > I do believe we could improve it, do more host type specific
> testing,
> > and rely less on falling back to a sys call (which I really don't > > like either).
> > I think there are plenty other options. Take a look at what > Sys::Hostname::FQDN and Net::Domain are doing. > > I know that portably getting the full hostname can be a pain in the > ass, > but there /really/ should be a better solution than `su nobody -c > "hostname --fqdn"`.
Agreed, except... Note that the above is the last resort. Sys::Hostname::Long goes through heaps of ways of doing it, same as the Sys::Hostname does. Although, I wrote Sys::Hostname::Long quite a long time ago, and FQDN was written many years after that, so maybe if they are doing it better it should be retired or combined. Scott