You are not logged in.

#1 2020-10-07 07:49:34

milaxnuts
Member
Registered: 2020-10-07
Posts: 3

want to change /etc/profile

hello bbs

i want to send a patch for /etc/profile

i want to replace these six lines

# Append our default paths
appendpath () {
    case ":$PATH:" in
        *:"$1":*)
            ;;
        *)
            PATH="${PATH:+$PATH:}$1"
    esac
}

with this one line

# Append our default paths
appendpath () {
    [[ ":$PATH:" != *":$1:"* ]] && PATH="${PATH:+$PATH:}$1"
}

now ....

$ pacman -Qo /etc/profile
/etc/profile is owned by filesystem 2020.05.07-1

$ pacman -Qi filesystem | grep http
URL             : https://www.archlinux.org

questions

1. where is the source code of package filesystem?
2. where do i send the patch?

Offline

#2 2020-10-07 08:00:55

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: want to change /etc/profile

Why should this patch be accepted? What's the inherent advantage of it?

Your function produces a failing return code, by the way. It is also invalid syntax for various /bin/sh shells that don't implement [[

/etc/profile is NOT bash.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2020-10-07 08:02:10

GaKu999
Member
From: US/Eastern
Registered: 2020-06-21
Posts: 696

Re: want to change /etc/profile

That’s a bashism, it looks like that because it’s (and must be) POSIX...

Edit: argh @eschwartz beated me

Last edited by GaKu999 (2020-10-07 08:02:47)


My reposSome snippets

Heisenberg might have been here.

Offline

#4 2020-10-07 12:01:08

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,237
Website

Re: want to change /etc/profile

milaxnuts wrote:

1. where is the source code of package filesystem?

https://git.archlinux.org/svntogit/pack … nk/profile

milaxnuts wrote:

2. where do i send the patch?

https://bugs.archlinux.org/

Others have already explained why a patch for this is *extremely* unlikely to be accepted, and you've not explained why it should either.

Offline

#5 2020-10-07 18:44:27

milaxnuts
Member
Registered: 2020-10-07
Posts: 3

Re: want to change /etc/profile

eschwartz wrote:

It is also invalid syntax for various /bin/sh shells that don't implement [[

/etc/profile is NOT bash.

that is a killer argument : /

GaKu999 wrote:

it looks like that because it’s (and must be) POSIX...

thanks for answering my hidden question

Last edited by milaxnuts (2020-10-07 19:05:33)

Offline

#6 2020-10-08 05:42:47

milaxnuts
Member
Registered: 2020-10-07
Posts: 3

Re: want to change /etc/profile

lets just ask some shells, how they like my pretty code

#!/bin/bash

s=$(cat <<'EOF'
#!/bin/sh
[[ 1 == 1 ]] && echo y
EOF
)

bash -c "$s"
# -> y

dash -c "$s"
# -> dash: 2: [[: not found
# rc = 127

posh -c "$s"
# -> posh: [[: not found
# rc = 127

ash and mrsh will probably give the same answer

shellcheck.net says: SC3010: In POSIX sh, [[ ]] is undefined.

related: How can I test for POSIX compliance of shell scripts?

Offline

Board footer

Powered by FluxBB