FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-26-2011, 07:46 PM
Dan McGee
 
Default Remove -f option from ln for POSIX compliance (close FS#24893)

On Sun, Jun 26, 2011 at 2:13 PM, Eric Bélanger <snowmaniscool@gmail.com> wrote:

Looks mostly good, only one comment below.

d> Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
> ---
> *scripts/makepkg.sh.in *| * 18 ++++++++++++------
> *scripts/repo-add.sh.in | * 10 ++++++----
> *2 files changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 8d082a2..ed5cdef 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -518,7 +518,8 @@ download_sources() {
> * * * * * * * *local file=$(get_filepath "$netfile" || true)
> * * * * * * * *if [[ -n "$file" ]]; then
> * * * * * * * * * * * *msg2 "$(gettext "Found %s")" "${file##*/}"
> - * * * * * * * * * * * ln -sf "$file" "$srcdir/"
> + * * * * * * * * * * * rm -f "$srcdir/$file"
> + * * * * * * * * * * * ln -s "$file" "$srcdir/"
Is this behavior (specifying a directory for the link name)
POSIX-compliant or guaranteed by anything except GNU ls?

> * * * * * * * * * * * *continue
> * * * * * * * *fi
>
> @@ -878,8 +879,8 @@ tidy_install() {
> * * * * * * * * * * * * * * * *# update symlinks to this manpage
> * * * * * * * * * * * * * * * *find ${MAN_DIRS[@]} -lname "$file" 2>/dev/null |
> * * * * * * * * * * * * * * * *while read link ; do
> - * * * * * * * * * * * * * * * * * * * rm -f "$link"
> - * * * * * * * * * * * * * * * * * * * ln -sf "${file}.gz" "${link}.gz"
> + * * * * * * * * * * * * * * * * * * * rm -f "$link" "${link}.gz"
> + * * * * * * * * * * * * * * * * * * * ln -s "${file}.gz" "${link}.gz"
> * * * * * * * * * * * * * * * *done
>
> * * * * * * * * * * * * * * * *# check file still exists (potentially already compressed due to hardlink)
> @@ -1187,9 +1188,13 @@ create_package() {
> * * * *create_signature "$pkg_file"
>
> * * * *if (( ! ret )) && [[ ! "$PKGDEST" -ef "${startdir}" ]]; then
> - * * * * * * * ln -sf "${pkg_file}" "${pkg_file/$PKGDEST/$startdir}"
> + * * * * * * * rm -f "${pkg_file/$PKGDEST/$startdir}"
> + * * * * * * * ln -s "${pkg_file}" "${pkg_file/$PKGDEST/$startdir}"
> * * * * * * * *ret=$?
> - * * * * * * * [[ -f $pkg_file.sig ]] && ln -sf "$pkg_file.sig" "${pkg_file/$PKGDEST/$startdir}.sig"
> + * * * * * * * if [[ -f $pkg_file.sig ]]; then
> + * * * * * * * * * * * rm -f "${pkg_file/$PKGDEST/$startdir}.sig"
> + * * * * * * * * * * * ln -s "$pkg_file.sig" "${pkg_file/$PKGDEST/$startdir}.sig"
> + * * * * * * * fi
> * * * *fi
>
> * * * *if (( ret )); then
> @@ -1276,7 +1281,8 @@ create_srcpackage() {
> * * * *fi
>
> * * * *if (( ! ret )) && [[ ! "$SRCPKGDEST" -ef "${startdir}" ]]; then
> - * * * * * * * ln -sf "${pkg_file}" "${pkg_file/$SRCPKGDEST/$startdir}"
> + * * * * * * * rm -f "${pkg_file/$SRCPKGDEST/$startdir}"
> + * * * * * * * ln -s "${pkg_file}" "${pkg_file/$SRCPKGDEST/$startdir}"
> * * * * * * * *ret=$?
> * * * *fi
>
> diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
> index e970da3..b125035 100644
> --- a/scripts/repo-add.sh.in
> +++ b/scripts/repo-add.sh.in
> @@ -613,12 +613,14 @@ if (( success )); then
> * * * *[[ -f $tmpdir/$filename.sig ]] && mv "$tmpdir/$filename.sig" "$REPO_DB_FILE.sig"
> * * * *dblink="${REPO_DB_FILE%.tar*}"
> * * * *target=${REPO_DB_FILE##*/}
> - * * * ln -sf "$target" "$dblink" 2>/dev/null ||
> - * * * * * * * ln -f "$target" "$dblink" 2>/dev/null ||
> + * * * rm -f "$dblink"
> + * * * ln -s "$target" "$dblink" 2>/dev/null ||
> + * * * * * * * ln "$target" "$dblink" 2>/dev/null ||
> * * * * * * * *cp "$REPO_DB_FILE" "$dblink"
> * * * *if [[ -f "$target.sig" ]]; then
> - * * * * * * * ln -sf "$target.sig" "$dblink.sig" 2>/dev/null ||
> - * * * * * * * * * * * ln -f "$target.sig" "$dblink.sig" 2>/dev/null ||
> + * * * * * * * rm -f "$dblink.sig"
> + * * * * * * * ln -s "$target.sig" "$dblink.sig" 2>/dev/null ||
> + * * * * * * * * * * * ln "$target.sig" "$dblink.sig" 2>/dev/null ||
> * * * * * * * * * * * *cp "$REPO_DB_FILE.sig" "$dblink.sig"
> * * * *fi
> *else
> --
> 1.7.5.4
>
>
>
 
Old 06-26-2011, 07:57 PM
Eric Bélanger
 
Default Remove -f option from ln for POSIX compliance (close FS#24893)

On Sun, Jun 26, 2011 at 3:46 PM, Dan McGee <dpmcgee@gmail.com> wrote:
> On Sun, Jun 26, 2011 at 2:13 PM, Eric Bélanger <snowmaniscool@gmail.com> wrote:
>
> Looks mostly good, only one comment below.
>
> d> Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
>> ---
>> *scripts/makepkg.sh.in *| * 18 ++++++++++++------
>> *scripts/repo-add.sh.in | * 10 ++++++----
>> *2 files changed, 18 insertions(+), 10 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 8d082a2..ed5cdef 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -518,7 +518,8 @@ download_sources() {
>> * * * * * * * *local file=$(get_filepath "$netfile" || true)
>> * * * * * * * *if [[ -n "$file" ]]; then
>> * * * * * * * * * * * *msg2 "$(gettext "Found %s")" "${file##*/}"
>> - * * * * * * * * * * * ln -sf "$file" "$srcdir/"
>> + * * * * * * * * * * * rm -f "$srcdir/$file"
>> + * * * * * * * * * * * ln -s "$file" "$srcdir/"
> Is this behavior (specifying a directory for the link name)
> POSIX-compliant or guaranteed by anything except GNU ls?

No idea. It was already used in another place in makepkg.sh.in so I
supposed that it was OK. If you want, I can resent the patch with the
link name specified.
 
Old 06-26-2011, 08:07 PM
Dan McGee
 
Default Remove -f option from ln for POSIX compliance (close FS#24893)

On Sun, Jun 26, 2011 at 2:57 PM, Eric Bélanger <snowmaniscool@gmail.com> wrote:
> On Sun, Jun 26, 2011 at 3:46 PM, Dan McGee <dpmcgee@gmail.com> wrote:
>> On Sun, Jun 26, 2011 at 2:13 PM, Eric Bélanger <snowmaniscool@gmail.com> wrote:
>>
>> Looks mostly good, only one comment below.
>>
>> d> Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
>>> ---
>>> *scripts/makepkg.sh.in *| * 18 ++++++++++++------
>>> *scripts/repo-add.sh.in | * 10 ++++++----
>>> *2 files changed, 18 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>> index 8d082a2..ed5cdef 100644
>>> --- a/scripts/makepkg.sh.in
>>> +++ b/scripts/makepkg.sh.in
>>> @@ -518,7 +518,8 @@ download_sources() {
>>> * * * * * * * *local file=$(get_filepath "$netfile" || true)
>>> * * * * * * * *if [[ -n "$file" ]]; then
>>> * * * * * * * * * * * *msg2 "$(gettext "Found %s")" "${file##*/}"
>>> - * * * * * * * * * * * ln -sf "$file" "$srcdir/"
>>> + * * * * * * * * * * * rm -f "$srcdir/$file"
>>> + * * * * * * * * * * * ln -s "$file" "$srcdir/"
>> Is this behavior (specifying a directory for the link name)
>> POSIX-compliant or guaranteed by anything except GNU ls?
>
> No idea. It was already used in another place in makepkg.sh.in so I
> supposed that it was OK. If you want, I can resent the patch with the
> link name specified.

Well looking around, this whole bug report is a bit of BS, although we
can easily work around this. -s and -f are both mandatory in the
"latest", as of 2003, spec. [1] The same spec also indicates that this
"target_dir" vs. "target_file" behavior is completely OK, so no need
to fix this up unless we actually see problems in the wild.

-Dan

[1] http://www.unix.com/man-page/posix/1posix/ln/
 
Old 06-26-2011, 11:43 PM
Allan McRae
 
Default Remove -f option from ln for POSIX compliance (close FS#24893)

On 27/06/11 06:07, Dan McGee wrote:

On Sun, Jun 26, 2011 at 2:57 PM, Eric Bélanger<snowmaniscool@gmail.com> wrote:

On Sun, Jun 26, 2011 at 3:46 PM, Dan McGee<dpmcgee@gmail.com> wrote:

On Sun, Jun 26, 2011 at 2:13 PM, Eric Bélanger<snowmaniscool@gmail.com> wrote:

Looks mostly good, only one comment below.

d> Signed-off-by: Eric Bélanger<snowmaniscool@gmail.com>

---
scripts/makepkg.sh.in | 18 ++++++++++++------
scripts/repo-add.sh.in | 10 ++++++----
2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 8d082a2..ed5cdef 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -518,7 +518,8 @@ download_sources() {
local file=$(get_filepath "$netfile" || true)
if [[ -n "$file" ]]; then
msg2 "$(gettext "Found %s")" "${file##*/}"
- ln -sf "$file" "$srcdir/"
+ rm -f "$srcdir/$file"
+ ln -s "$file" "$srcdir/"

Is this behavior (specifying a directory for the link name)
POSIX-compliant or guaranteed by anything except GNU ls?


No idea. It was already used in another place in makepkg.sh.in so I
supposed that it was OK. If you want, I can resent the patch with the
link name specified.


Well looking around, this whole bug report is a bit of BS, although we
can easily work around this. -s and -f are both mandatory in the
"latest", as of 2003, spec. [1] The same spec also indicates that this
"target_dir" vs. "target_file" behavior is completely OK, so no need
to fix this up unless we actually see problems in the wild.

-Dan

[1] http://www.unix.com/man-page/posix/1posix/ln/



I'll ack the patch as is. Removing the "-f" usage in ln is a small
burden if we have people who actually want to use old shitty versions of
these tools. Any further issues can be fixed later (preferably by the
people experiencing the problems).


Allan
 

Thread Tools




All times are GMT. The time now is 02:31 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org