Re: svn commit: r289269 - head/usr.sbin/tzsetup

2015-10-26 Thread Adrian Chadd
Hi,

Please don't break non-root builds. I may get stabby.

:)



-adrian


On 26 October 2015 at 19:44, Bryan Drewery  wrote:
> On 10/13/2015 3:55 PM, Xin LI wrote:
>> Author: delphij
>> Date: Tue Oct 13 22:55:17 2015
>> New Revision: 289269
>> URL: https://svnweb.freebsd.org/changeset/base/289269
>>
>> Log:
>>   Use chroot(2) instead of using prefixes for files.
>>
>>   Previously, the code prefixes the chroot path to actual file paths to
>>   simulate the effect.  This, however, will not work for tzset(3) which
>>   expects the current system have a working set of timezone data files,
>>   and that is not always the case.
>>
>>   This changeset simplifies the handling of paths and use an actual
>>   chroot(2) call to implement the effect.
>>
>>   PR: bin/197313
>>   MFC after:  2 weeks
>>
>> Modified:
>>   head/usr.sbin/tzsetup/tzsetup.c
>>
>> Modified: head/usr.sbin/tzsetup/tzsetup.c
>> ==
>> --- head/usr.sbin/tzsetup/tzsetup.c   Tue Oct 13 21:34:54 2015
>> (r289268)
>> +++ head/usr.sbin/tzsetup/tzsetup.c   Tue Oct 13 22:55:17 2015
>> (r289269)
>> @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>
>> @@ -944,23 +945,18 @@ main(int argc, char **argv)
>>   if (argc - optind > 1)
>>   usage();
>>
>> - if (chrootenv == NULL) {
>
> I would think there would be a reason for not really using chroot(2)
> here, such as preparing images as non-root.
>
> --
> Regards,
> Bryan Drewery
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r289269 - head/usr.sbin/tzsetup

2015-10-26 Thread Bryan Drewery
On 10/13/2015 3:55 PM, Xin LI wrote:
> Author: delphij
> Date: Tue Oct 13 22:55:17 2015
> New Revision: 289269
> URL: https://svnweb.freebsd.org/changeset/base/289269
> 
> Log:
>   Use chroot(2) instead of using prefixes for files.
>   
>   Previously, the code prefixes the chroot path to actual file paths to
>   simulate the effect.  This, however, will not work for tzset(3) which
>   expects the current system have a working set of timezone data files,
>   and that is not always the case.
>   
>   This changeset simplifies the handling of paths and use an actual
>   chroot(2) call to implement the effect.
>   
>   PR: bin/197313
>   MFC after:  2 weeks
> 
> Modified:
>   head/usr.sbin/tzsetup/tzsetup.c
> 
> Modified: head/usr.sbin/tzsetup/tzsetup.c
> ==
> --- head/usr.sbin/tzsetup/tzsetup.c   Tue Oct 13 21:34:54 2015
> (r289268)
> +++ head/usr.sbin/tzsetup/tzsetup.c   Tue Oct 13 22:55:17 2015
> (r289269)
> @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -944,23 +945,18 @@ main(int argc, char **argv)
>   if (argc - optind > 1)
>   usage();
>  
> - if (chrootenv == NULL) {

I would think there would be a reason for not really using chroot(2)
here, such as preparing images as non-root.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r289269 - head/usr.sbin/tzsetup

2015-10-26 Thread Xin Li
On 10/26/15 18:07, Adrian Chadd wrote:
> Hi,
> 
> Please don't break non-root builds. I may get stabby.
> 
> :)

Will revert now.

> -adrian
> 
> 
> On 26 October 2015 at 19:44, Bryan Drewery  wrote:
>> On 10/13/2015 3:55 PM, Xin LI wrote:
>>> Author: delphij
>>> Date: Tue Oct 13 22:55:17 2015
>>> New Revision: 289269
>>> URL: https://svnweb.freebsd.org/changeset/base/289269
>>>
>>> Log:
>>>   Use chroot(2) instead of using prefixes for files.
>>>
>>>   Previously, the code prefixes the chroot path to actual file paths to
>>>   simulate the effect.  This, however, will not work for tzset(3) which
>>>   expects the current system have a working set of timezone data files,
>>>   and that is not always the case.
>>>
>>>   This changeset simplifies the handling of paths and use an actual
>>>   chroot(2) call to implement the effect.
>>>
>>>   PR: bin/197313
>>>   MFC after:  2 weeks
>>>
>>> Modified:
>>>   head/usr.sbin/tzsetup/tzsetup.c
>>>
>>> Modified: head/usr.sbin/tzsetup/tzsetup.c
>>> ==
>>> --- head/usr.sbin/tzsetup/tzsetup.c   Tue Oct 13 21:34:54 2015
>>> (r289268)
>>> +++ head/usr.sbin/tzsetup/tzsetup.c   Tue Oct 13 22:55:17 2015
>>> (r289269)
>>> @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
>>>  #include 
>>>  #include 
>>>  #include 
>>> +#include 
>>>  #include 
>>>  #include 
>>>
>>> @@ -944,23 +945,18 @@ main(int argc, char **argv)
>>>   if (argc - optind > 1)
>>>   usage();
>>>
>>> - if (chrootenv == NULL) {
>>
>> I would think there would be a reason for not really using chroot(2)
>> here, such as preparing images as non-root.
>>
>> --
>> Regards,
>> Bryan Drewery
>>
> 


-- 
Xin LI https://www.delphij.net/
FreeBSD - The Power to Serve!   Live free or die



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r289269 - head/usr.sbin/tzsetup

2015-10-26 Thread Adrian Chadd
aw thanks

I would really love to see a non-terrible way to do this stuff. :(


-a


On 26 October 2015 at 20:25, Xin Li  wrote:
> On 10/26/15 18:07, Adrian Chadd wrote:
>> Hi,
>>
>> Please don't break non-root builds. I may get stabby.
>>
>> :)
>
> Will revert now.
>
>> -adrian
>>
>>
>> On 26 October 2015 at 19:44, Bryan Drewery  wrote:
>>> On 10/13/2015 3:55 PM, Xin LI wrote:
 Author: delphij
 Date: Tue Oct 13 22:55:17 2015
 New Revision: 289269
 URL: https://svnweb.freebsd.org/changeset/base/289269

 Log:
   Use chroot(2) instead of using prefixes for files.

   Previously, the code prefixes the chroot path to actual file paths to
   simulate the effect.  This, however, will not work for tzset(3) which
   expects the current system have a working set of timezone data files,
   and that is not always the case.

   This changeset simplifies the handling of paths and use an actual
   chroot(2) call to implement the effect.

   PR: bin/197313
   MFC after:  2 weeks

 Modified:
   head/usr.sbin/tzsetup/tzsetup.c

 Modified: head/usr.sbin/tzsetup/tzsetup.c
 ==
 --- head/usr.sbin/tzsetup/tzsetup.c   Tue Oct 13 21:34:54 2015
 (r289268)
 +++ head/usr.sbin/tzsetup/tzsetup.c   Tue Oct 13 22:55:17 2015
 (r289269)
 @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
  #include 
  #include 
  #include 
 +#include 
  #include 
  #include 

 @@ -944,23 +945,18 @@ main(int argc, char **argv)
   if (argc - optind > 1)
   usage();

 - if (chrootenv == NULL) {
>>>
>>> I would think there would be a reason for not really using chroot(2)
>>> here, such as preparing images as non-root.
>>>
>>> --
>>> Regards,
>>> Bryan Drewery
>>>
>>
>
>
> --
> Xin LI https://www.delphij.net/
> FreeBSD - The Power to Serve!   Live free or die
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r289269 - head/usr.sbin/tzsetup

2015-10-13 Thread Xin LI
Author: delphij
Date: Tue Oct 13 22:55:17 2015
New Revision: 289269
URL: https://svnweb.freebsd.org/changeset/base/289269

Log:
  Use chroot(2) instead of using prefixes for files.
  
  Previously, the code prefixes the chroot path to actual file paths to
  simulate the effect.  This, however, will not work for tzset(3) which
  expects the current system have a working set of timezone data files,
  and that is not always the case.
  
  This changeset simplifies the handling of paths and use an actual
  chroot(2) call to implement the effect.
  
  PR:   bin/197313
  MFC after:2 weeks

Modified:
  head/usr.sbin/tzsetup/tzsetup.c

Modified: head/usr.sbin/tzsetup/tzsetup.c
==
--- head/usr.sbin/tzsetup/tzsetup.c Tue Oct 13 21:34:54 2015
(r289268)
+++ head/usr.sbin/tzsetup/tzsetup.c Tue Oct 13 22:55:17 2015
(r289269)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -944,23 +945,18 @@ main(int argc, char **argv)
if (argc - optind > 1)
usage();
 
-   if (chrootenv == NULL) {
-   strcpy(path_zonetab, _PATH_ZONETAB);
-   strcpy(path_iso3166, _PATH_ISO3166);
-   strcpy(path_zoneinfo, _PATH_ZONEINFO);
-   strcpy(path_localtime, _PATH_LOCALTIME);
-   strcpy(path_db, _PATH_DB);
-   strcpy(path_wall_cmos_clock, _PATH_WALL_CMOS_CLOCK);
-   } else {
-   sprintf(path_zonetab, "%s/%s", chrootenv, _PATH_ZONETAB);
-   sprintf(path_iso3166, "%s/%s", chrootenv, _PATH_ISO3166);
-   sprintf(path_zoneinfo, "%s/%s", chrootenv, _PATH_ZONEINFO);
-   sprintf(path_localtime, "%s/%s", chrootenv, _PATH_LOCALTIME);
-   sprintf(path_db, "%s/%s", chrootenv, _PATH_DB);
-   sprintf(path_wall_cmos_clock, "%s/%s", chrootenv,
-   _PATH_WALL_CMOS_CLOCK);
+   if (chrootenv != NULL) {
+   rv = chroot(chrootenv);
+   if (rv != 0)
+   err(EX_OSERR, "chroot to %s", chrootenv);
}
 
+   strcpy(path_zonetab, _PATH_ZONETAB);
+   strcpy(path_iso3166, _PATH_ISO3166);
+   strcpy(path_zoneinfo, _PATH_ZONEINFO);
+   strcpy(path_localtime, _PATH_LOCALTIME);
+   strcpy(path_db, _PATH_DB);
+   strcpy(path_wall_cmos_clock, _PATH_WALL_CMOS_CLOCK);
 
/* Override the user-supplied umask. */
(void)umask(S_IWGRP | S_IWOTH);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"