Bug 87351

Summary: Jail building instructions don't work as described with default CSH shell
Product: Documentation Reporter: Eli K. Breen <bsd>
Component: Books & ArticlesAssignee: Giorgos Keramidas <keramida>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Eli K. Breen 2005-10-13 01:10:18 UTC
Building jails does not work as perscribed in the man (8) jail docs. The default shell for root on a new and stock FreeBSD box is csh, the instruction include the line:
D=/path/to/your/jail
..which does not work under csh, this returns a Command Not Found error.

Fix: 

jail manpage currently reads:

     D=/here/is/the/jail
     cd /usr/src
     mkdir -p $D
     make world DESTDIR=$D
     cd etc
     make distribution DESTDIR=$D
     mount_devfs devfs $D/dev
     cd $D
     ln -sf dev/null kernel

..and should read:
     set D=/here/is/the/jail
     cd /usr/src
     mkdir -p $D
     make world DESTDIR=$D
     cd etc
     make distribution DESTDIR=$D
     mount_devfs devfs $D/dev
     cd $D
     ln -sf dev/null kernel
.. or specify that the instructions do not work under csh.
How-To-Repeat: switch to csh, try to build a jail using the supplied instructions from the jail(8) manpage.

..
user@box# csh
user@box# D=/path/to/your/jail
D=/path/to/your/jail: Command not found.
user@box#
Comment 1 Giorgos Keramidas freebsd_committer freebsd_triage 2005-10-22 18:32:32 UTC
On 2005-10-13 00:05, "Eli K. Breen" <bsd@unixforge.net> wrote:
> Building jails does not work as perscribed in the man (8) jail
> docs. The default shell for root on a new and stock FreeBSD box is
> csh, the instruction include the line:
>
> D=/path/to/your/jail
>
> ..which does not work under csh, this returns a Command Not Found error.

> switch to csh, try to build a jail using the supplied instructions
> from the jail(8) manpage.

> user@box# csh
> user@box# D=/path/to/your/jail
> D=/path/to/your/jail: Command not found.
> user@box#

> jail manpage currently reads:
>
>      D=/here/is/the/jail
>      cd /usr/src
>      mkdir -p $D
>      make world DESTDIR=$D
>      cd etc
>      make distribution DESTDIR=$D
>      mount_devfs devfs $D/dev
>      cd $D
>      ln -sf dev/null kernel
>
> ..and should read:
>
>      set D=/here/is/the/jail
>      cd /usr/src
>      mkdir -p $D
>      make world DESTDIR=$D
>      cd etc
>      make distribution DESTDIR=$D
>      mount_devfs devfs $D/dev
>      cd $D
>      ln -sf dev/null kernel
>
> .. or specify that the instructions do not work under csh.

I'd certainly support adding a note that these commands work fine fror
sh(1) and other Bourne shells.  Then we can probably add another set of
commands for csh, if that seems nice to have.
Comment 2 Giorgos Keramidas freebsd_committer freebsd_triage 2005-10-26 13:05:54 UTC
On 2005-10-25 19:17, Tom Rhodes <trhodes@FreeBSD.org> wrote:
>On Mon, 24 Oct 2005 10:40:54 -0700
>Brooks Davis <brooks@one-eyed-alien.net> wrote:
>>On Sun, Oct 23, 2005 at 12:10:20AM +0000, Giorgos Keramidas wrote:
>>>  I'd certainly support adding a note that these commands work fine fror
>>>  sh(1) and other Bourne shells.  Then we can probably add another set of
>>>  commands for csh, if that seems nice to have.
>>
>> Shell examples are traditionally in sh.  I'd really rather not see use
>> bloat every instance of them with a csh example.  Users can always type
>> "sh".
>
> I'm inclined to agree with Brooks.

Alright then.  How about this change?

% Index: jail.8
% ===================================================================
% RCS file: /home/ncvs/src/usr.sbin/jail/jail.8,v
% retrieving revision 1.70
% diff -u -r1.70 jail.8
% --- jail.8      7 Aug 2005 20:53:29 -0000       1.70
% +++ jail.8      26 Oct 2005 12:03:42 -0000
% @@ -110,10 +110,11 @@
%  man page for further details.
%  .Sh EXAMPLES
%  .Ss "Setting up a Jail Directory Tree"
% -This example shows how to set up a jail directory tree
% -containing an entire
% +To set up a jail directory tree containing an entire
%  .Fx
% -distribution:
% +distribution, the following
% +.Xr sh 1
% +command script can be used:
%  .Bd -literal
%  D=/here/is/the/jail
%  cd /usr/src

This way the reader knows that this is an sh(1) command script.

One may argue that people who are setting up jails are already admins
who should be able to understand if a script is meant to be run through
sh(1), csh(1) or even both, but I'll never stop being a fan of a little
more clarity :-)
Comment 3 Simon L. B. Nielsen freebsd_committer freebsd_triage 2005-10-26 13:22:30 UTC
On 2005.10.26 12:10:24 +0000, Giorgos Keramidas wrote:

>  Alright then.  How about this change?
>  
>  % Index: jail.8
>  % ===================================================================
>  % RCS file: /home/ncvs/src/usr.sbin/jail/jail.8,v
>  % retrieving revision 1.70
>  % diff -u -r1.70 jail.8
>  % --- jail.8      7 Aug 2005 20:53:29 -0000       1.70
>  % +++ jail.8      26 Oct 2005 12:03:42 -0000
>  % @@ -110,10 +110,11 @@
>  %  man page for further details.
>  %  .Sh EXAMPLES
>  %  .Ss "Setting up a Jail Directory Tree"
>  % -This example shows how to set up a jail directory tree
>  % -containing an entire
>  % +To set up a jail directory tree containing an entire
>  %  .Fx
>  % -distribution:
>  % +distribution, the following
>  % +.Xr sh 1
>  % +command script can be used:
>  %  .Bd -literal
>  %  D=/here/is/the/jail
>  %  cd /usr/src
>  
>  This way the reader knows that this is an sh(1) command script.


This looks like a good solution to me (and is similar to what I
suggested for the WIP Jail section for the Handbook).

>  One may argue that people who are setting up jails are already admins
>  who should be able to understand if a script is meant to be run through
>  sh(1), csh(1) or even both, but I'll never stop being a fan of a little
>  more clarity :-)


Well... :-).

-- 
Simon L. Nielsen
Comment 4 Giorgos Keramidas freebsd_committer freebsd_triage 2005-10-26 21:18:41 UTC
State Changed
From-To: open->patched


I've just committed a note that points to sh(1) in CURRENT. 
The change will be MFC'ed in a few days.  If I get approval 
early enough it will even be in 6.0-RELEASE. 

Thanks for the problem report :)
Comment 5 Giorgos Keramidas freebsd_committer freebsd_triage 2005-10-26 21:21:12 UTC
Responsible Changed
From-To: freebsd-doc->keramida

Grab this, as a reminder to MFC the committed change.
Comment 6 Tom Rhodes freebsd_committer freebsd_triage 2005-10-27 11:06:47 UTC
On Wed, 26 Oct 2005 15:05:54 +0300
Giorgos Keramidas <keramida@freebsd.org> wrote:

> On 2005-10-25 19:17, Tom Rhodes <trhodes@FreeBSD.org> wrote:
> >On Mon, 24 Oct 2005 10:40:54 -0700
> >Brooks Davis <brooks@one-eyed-alien.net> wrote:
> >>On Sun, Oct 23, 2005 at 12:10:20AM +0000, Giorgos Keramidas wrote:
> >>>  I'd certainly support adding a note that these commands work fine fror
> >>>  sh(1) and other Bourne shells.  Then we can probably add another set of
> >>>  commands for csh, if that seems nice to have.
> >>
> >> Shell examples are traditionally in sh.  I'd really rather not see use
> >> bloat every instance of them with a csh example.  Users can always type
> >> "sh".
> >
> > I'm inclined to agree with Brooks.
> 
> Alright then.  How about this change?
> 
> % Index: jail.8
> % ===================================================================
> % RCS file: /home/ncvs/src/usr.sbin/jail/jail.8,v
> % retrieving revision 1.70
> % diff -u -r1.70 jail.8
> % --- jail.8      7 Aug 2005 20:53:29 -0000       1.70
> % +++ jail.8      26 Oct 2005 12:03:42 -0000
> % @@ -110,10 +110,11 @@
> %  man page for further details.
> %  .Sh EXAMPLES
> %  .Ss "Setting up a Jail Directory Tree"
> % -This example shows how to set up a jail directory tree
> % -containing an entire
> % +To set up a jail directory tree containing an entire
> %  .Fx
> % -distribution:
> % +distribution, the following
> % +.Xr sh 1
> % +command script can be used:
> %  .Bd -literal
> %  D=/here/is/the/jail
> %  cd /usr/src
> 
> This way the reader knows that this is an sh(1) command script.
> 
> One may argue that people who are setting up jails are already admins
> who should be able to understand if a script is meant to be run through
> sh(1), csh(1) or even both, but I'll never stop being a fan of a little
> more clarity :-)

Exactly, though I think this is benign for exactly the
reason you stated.  I'm going to take the medium path -
not care either way.  So if Brooks doesn't have a problem
then go.  Thanks!

-- 
Tom Rhodes
Comment 7 Matteo Riondato freebsd_committer freebsd_triage 2006-05-26 11:18:47 UTC
State Changed
From-To: patched->closed

I merged the patch keramida@ committed