GNU bug report logs - #10837
bug of install program

Previous Next

Package: coreutils;

Reported by: 陈燕潘 <custa <at> 126.com>

Date: Fri, 17 Feb 2012 18:38:01 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: 陈燕潘 <custa <at> 126.com>
Subject: bug#10837: closed (Re: bug#10837: bug of install program)
Date: Fri, 17 Feb 2012 18:53:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#10837: bug of install program

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 10837 <at> debbugs.gnu.org.

-- 
10837: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10837
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eric Blake <eblake <at> redhat.com>
To: 陈燕潘 <custa <at> 126.com>
Cc: 10837-done <at> debbugs.gnu.org
Subject: Re: bug#10837: bug of install program
Date: Fri, 17 Feb 2012 11:50:17 -0700
[Message part 3 (text/plain, inline)]
tag 10837 notabug
thanks

On 02/17/2012 10:30 AM, 陈燕潘 wrote:
> Hi, I come across a problem, I don't whether it is a bug.
> Version of install is 7.1.

Thanks for the report.  Your install is a bit old; right now, the
current version is 8.15.  However, the behavior you are reporting is
intentional, and has not changed in the meantime.

> I have something look like this:
> opensuse113:/home/test_install # find 1/
> 1/
> 1/a
> 1/a/b
> 1/a/b/c
> 1/a/b/c/d.txt
> 1/a/b/c/d
> opensuse113:/home/test_install # find 2/
> 2/
> I want to copy everything in 1/a/b/c to 2/a/b/c. So I use the command with the option -D, but it doesn't work.
> opensuse113:/home/test_install # install -D 1/a/b/c/* 2/a/b/c
> install: target `2/a/b/c' is not a directory

Let's revisit the 'install --help' output, and see why:

Usage: install [OPTION]... [-T] SOURCE DEST
  or:  install [OPTION]... SOURCE... DIRECTORY
  or:  install [OPTION]... -t DIRECTORY SOURCE...
  or:  install [OPTION]... -d DIRECTORY...
...
In the first three forms, copy SOURCE to DEST or multiple SOURCE(s) to
the existing DIRECTORY, while setting permission modes and owner/group.
...
  -D                  create all leading components of DEST except the last,
                        then copy SOURCE to DEST

> 
> Wht not create the directory 2/a/b/c, then copy everying?

Note that you ended up invoking the second form (multiple source files,
to an existing directory), but that -D is only useful with the first
form (single source file, and a DEST that gets created with the same
contents as the single source).  That is, we intentionally treat the
DEST of form 1 differently than the DIRECTORY of form 2.

>  
> Looking forward to your reply.

I'd recommend that you split this into two steps, which will work now:

install -d 2/a/b/c && install 1/a/b/c/* 2/a/b/c

Or, you can propose a patch to make -D work with the second form (that
is, have it interact with a DIRECTORY by creating all elements, compared
to its current documentation of interacting only with a DEST where only
the leading directories, but not the last element, are created).  But
I'm not sure if such a patch would make matters more confusing.  Maybe
it's better to just propose a patch that rejects -D when using form 2,
rather than the current behavior of accepting -D only to fail because it
would create 2/a/b but not 2/a/b/c, and needs 2/a/b/c to exist as a
target directory.

But since such a patch is a wishlist for a minor improvement, rather
than an actual bug fix, I'm closing this bug for now.  We can reopen it
if needed, and you can feel free to add further comments even while the
bug is closed.

-- 
Eric Blake   eblake <at> redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]
[Message part 5 (message/rfc822, inline)]
From: 陈燕潘 <custa <at> 126.com>
To: bug-coreutils <at> gnu.org
Subject: bug of install program
Date: Sat, 18 Feb 2012 01:30:05 +0800 (CST)
[Message part 6 (text/plain, inline)]
Hi, I come across a problem, I don't whether it is a bug.
Version of install is 7.1.
I have something look like this:
opensuse113:/home/test_install # find 1/
1/
1/a
1/a/b
1/a/b/c
1/a/b/c/d.txt
1/a/b/c/d
opensuse113:/home/test_install # find 2/
2/
I want to copy everything in 1/a/b/c to 2/a/b/c. So I use the command with the option -D, but it doesn't work.
opensuse113:/home/test_install # install -D 1/a/b/c/* 2/a/b/c
install: target `2/a/b/c' is not a directory

Wht not create the directory 2/a/b/c, then copy everying?
 
Looking forward to your reply.


--
custa
[Message part 7 (text/html, inline)]

This bug report was last modified 13 years and 88 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.