delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/06/23/06:30:25

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "John Morrison" <john DOT r DOT morrison AT ntlworld DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: Patch for Bug in /etc/profile script ....
Date: Mon, 23 Jun 2003 10:55:02 +0100
Message-ID: <NCEBJJFMCAOKNNABBFIMEEBDEAAA.john.r.morrison@ntlworld.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
In-Reply-To: <JLEBIHHBMBHBAFPAJLEFCEGDDNAA.miles0201@cox.net>
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Importance: Normal

> From: Alan Miles
>
> All,
>
> I have a file called /etc/skel/a/b/c/d.txt, /etc/skel/e/f.txt
>
> Under Linux (and I certainly believe the same is true for UNIX), anything,
> directory(s), file(s) etc put in /etc/skel
> gets put into the user's home directory when the sys admin creates the
> account and its home directory.
>
> However, that is not happening here.
>
> What is happening here in these two examples is that it is trying to copy
> the file:
>
> cp /etc/skel/a/b/c/d.txt /home/user1/a/b/c/d.txt
> cp /etc/skel/e/f.txt     /home/user1/e/f.txt
>
> Now this ** would ** work if the directories /home/user1/a/b/c/, and
> /home/user1/e had already existed. However, they don't since the system
> is creating the home directory. Hence the copy fails.
>
> I am submitting this patch which corrects the problem. the key is the -D
> flag on the install command - it causes the system to create any missing
> leading directories, as well as doing the install.
>
> $ diff -u /etc/profile.old profile
> --- /etc/profile.old    2003-06-14 10:03:21.000000000 -0500
> +++ profile     2003-06-23 04:01:00.000000000 -0500
> @@ -32,7 +32,7 @@
>    for f in `/bin/find . -type f`; do
>      fDest=`echo $f | sed -e 's/^\.//g'`
>      if [ ! -e "$HOME$fDest" -a ! -L "$HOME$fDest" ]; then
> -      cp "$f" "$HOME/$fDest"
> +      /usr/bin/install -D -p -v "${f}" "${HOME}/${fDest}"
>      fi
>    done
>  fi

Thank you.  I didn't know about the /usr/bin/install program.
I'm in the process of updating the base- packages (slowly :(
I'll do this mod then.

Thanks again,

J.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019