• Fix the error in some csh scripts.

    From hongyi.zhao@gmail.com@21:1/5 to All on Sun Jan 29 22:53:58 2023
    On Ubuntu 22.10, I noticed that some system shipped environments initialization scripts have syntax or logic errors as follows:

    werner@X10DAi:~$ . /etc/profile.d/debuginfod.csh
    bash: debuginfod.csh.save: line 17: syntax error: unexpected end of file werner@X10DAi:~$ . /etc/profile.d/gawk.csh
    bash: alias: gawkpath_default: not found
    bash: alias: `unsetenv AWKPATH; setenv AWKPATH `gawk -v x': invalid alias name bash: alias: gawkpath_prepend: not found
    bash: alias: `if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH ': invalid alias name
    bash: alias: gawkpath_append: not found
    bash: alias: `if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH ': invalid alias name
    bash: alias: gawklibpath_default: not found
    bash: alias: `unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x': invalid alias name
    bash: alias: gawklibpath_prepend: not found
    bash: alias: `if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH ': invalid alias name
    bash: alias: gawklibpath_append: not found
    bash: alias: `if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH ': invalid alias name
    werner@X10DAi:~$ . /etc/profile.d/vte.csh
    bash: vte.csh.save: line 19: syntax error near unexpected token `!'
    bash: vte.csh.save: line 19: `if ( ! $?prompt | ! $?tcsh | ! $?TERM | ! $?VTE_VERSION ) exit'

    Below are the contents of the above scripts:

    werner@X10DAi:~$ cat debuginfod.csh
    # $HOME/.login* or similar files may first set $DEBUGINFOD_URLS.
    # If $DEBUGINFOD_URLS is not set there, we set it from system *.url files.
    # $HOME/.*rc or similar files may then amend $DEBUGINFOD_URLS.
    # See also [man debuginfod-client-config] for other environment variables
    # such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.

    if (! $?DEBUGINFOD_URLS) then
    set prefix="/usr"
    set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls; :' "/etc/debuginfod" 2>/dev/null | tr '\n' ' '`
    if ( "$DEBUGINFOD_URLS" != "" ) then
    setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
    else
    unset DEBUGINFOD_URLS
    endif
    unset prefix
    endif

    werner@X10DAi:~$ cat gawk.csh.save
    alias gawkpath_default 'unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`'

    alias gawkpath_prepend 'if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH == "") then; unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKPATH "\!*"":$AWKPATH"'

    alias gawkpath_append 'if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH == "") then; unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKPATH "$AWKPATH"":\!*"'

    alias gawklibpath_default 'unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`'

    alias gawklibpath_prepend 'if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH == "") then; unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKLIBPATH "\!*"":$AWKLIBPATH"'

    alias gawklibpath_append 'if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH == "") then; unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKLIBPATH "$AWKLIBPATH"":\!*"'

    werner@X10DAi:~$ cat vte.csh.save
    # Copyright © 2019 Red Hat, Inc.
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program. If not, see <https://www.gnu.org/licenses/>.
    #
    # Red Hat Author(s): Carlos Santos

    # exit if non-interactive, csh, no terminal or old VTE versions
    if ( ! $?prompt | ! $?tcsh | ! $?TERM | ! $?VTE_VERSION ) exit

    switch($TERM)
    case xterm*:
    alias precmd 'echo -n "\e]7;file://$HOST"; /usr/libexec/vte-urlencode-cwd; echo -n "\e\\"'
    endsw


    I'm not familiar with these csh syntax in them. Any tips to fix these problems?

    Regards,
    Zhao

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to hongy...@gmail.com on Mon Jan 30 08:52:54 2023
    On 30.01.2023 07:53, hongy...@gmail.com wrote:
    werner@X10DAi:~$ . /etc/profile.d/debuginfod.csh
    bash: debuginfod.csh.save: line 17: syntax error: unexpected end of file

    On 30.01.2023 07:53, hongy...@gmail.com wrote:
    werner@X10DAi:~$ cat vte.csh.save
    # Copyright © 2019 Red Hat, Inc.

    On 30.01.2023 07:53, hongy...@gmail.com wrote:
    I'm not familiar with these csh syntax in them. Any tips to fix these
    problems?

    You are running 'csh' scripts (that stem from Redhat) with a 'bash'.
    So depending on who activated/called these scripts my suggestions are
    to use a csh interpreter (as opposed to a bash) to call the scripts,
    or, contact Redhat support if their distribution is buggy (which I'd
    consider unlikely, though).

    Janis


    On 30.01.2023 07:53, hongy...@gmail.com wrote:
    On Ubuntu 22.10, I noticed that some system shipped environments initialization scripts have syntax or logic errors as follows:

    werner@X10DAi:~$ . /etc/profile.d/debuginfod.csh
    bash: debuginfod.csh.save: line 17: syntax error: unexpected end of file werner@X10DAi:~$ . /etc/profile.d/gawk.csh
    bash: alias: gawkpath_default: not found
    bash: alias: `unsetenv AWKPATH; setenv AWKPATH `gawk -v x': invalid alias name
    bash: alias: gawkpath_prepend: not found
    bash: alias: `if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH ': invalid alias name
    bash: alias: gawkpath_append: not found
    bash: alias: `if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH ': invalid alias name
    bash: alias: gawklibpath_default: not found
    bash: alias: `unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x': invalid alias name
    bash: alias: gawklibpath_prepend: not found
    bash: alias: `if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH ': invalid alias name
    bash: alias: gawklibpath_append: not found
    bash: alias: `if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH ': invalid alias name
    werner@X10DAi:~$ . /etc/profile.d/vte.csh
    bash: vte.csh.save: line 19: syntax error near unexpected token `!'
    bash: vte.csh.save: line 19: `if ( ! $?prompt | ! $?tcsh | ! $?TERM | ! $?VTE_VERSION ) exit'

    Below are the contents of the above scripts:

    werner@X10DAi:~$ cat debuginfod.csh
    # $HOME/.login* or similar files may first set $DEBUGINFOD_URLS.
    # If $DEBUGINFOD_URLS is not set there, we set it from system *.url files.
    # $HOME/.*rc or similar files may then amend $DEBUGINFOD_URLS.
    # See also [man debuginfod-client-config] for other environment variables
    # such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.

    if (! $?DEBUGINFOD_URLS) then
    set prefix="/usr"
    set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls; :' "/etc/debuginfod" 2>/dev/null | tr '\n' ' '`
    if ( "$DEBUGINFOD_URLS" != "" ) then
    setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
    else
    unset DEBUGINFOD_URLS
    endif
    unset prefix
    endif

    werner@X10DAi:~$ cat gawk.csh.save
    alias gawkpath_default 'unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`'

    alias gawkpath_prepend 'if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH == "") then; unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKPATH "\!*"":$AWKPATH"'

    alias gawkpath_append 'if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH == "") then; unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKPATH "$AWKPATH"":\!*"'

    alias gawklibpath_default 'unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`'

    alias gawklibpath_prepend 'if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH == "") then; unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKLIBPATH "\!*"":$AWKLIBPATH"'

    alias gawklibpath_append 'if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH == "") then; unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKLIBPATH "$AWKLIBPATH"":\!*"'

    werner@X10DAi:~$ cat vte.csh.save
    # Copyright © 2019 Red Hat, Inc.
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program. If not, see <https://www.gnu.org/licenses/>.
    #
    # Red Hat Author(s): Carlos Santos

    # exit if non-interactive, csh, no terminal or old VTE versions
    if ( ! $?prompt | ! $?tcsh | ! $?TERM | ! $?VTE_VERSION ) exit

    switch($TERM)
    case xterm*:
    alias precmd 'echo -n "\e]7;file://$HOST"; /usr/libexec/vte-urlencode-cwd; echo -n "\e\\"'
    endsw


    I'm not familiar with these csh syntax in them. Any tips to fix these problems?

    Regards,
    Zhao




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jalen Q@21:1/5 to Janis Papanagnou on Sun Mar 5 16:51:04 2023
    On Monday, January 30, 2023 at 1:53:00 AM UTC-6, Janis Papanagnou wrote:
    On 30.01.2023 07:53, hongy...@gmail.com wrote:
    werner@X10DAi:~$ . /etc/profile.d/debuginfod.csh
    bash: debuginfod.csh.save: line 17: syntax error: unexpected end of file
    On 30.01.2023 07:53, hongy...@gmail.com wrote:
    werner@X10DAi:~$ cat vte.csh.save
    # Copyright © 2019 Red Hat, Inc.
    On 30.01.2023 07:53, hongy...@gmail.com wrote:
    I'm not familiar with these csh syntax in them. Any tips to fix these
    problems?
    You are running 'csh' scripts (that stem from Redhat) with a 'bash'.
    So depending on who activated/called these scripts my suggestions are
    to use a csh interpreter (as opposed to a bash) to call the scripts,
    or, contact Redhat support if their distribution is buggy (which I'd consider unlikely, though).

    Janis
    On 30.01.2023 07:53, hongy...@gmail.com wrote:
    On Ubuntu 22.10, I noticed that some system shipped environments initialization scripts have syntax or logic errors as follows:

    werner@X10DAi:~$ . /etc/profile.d/debuginfod.csh
    bash: debuginfod.csh.save: line 17: syntax error: unexpected end of file werner@X10DAi:~$ . /etc/profile.d/gawk.csh
    bash: alias: gawkpath_default: not found
    bash: alias: `unsetenv AWKPATH; setenv AWKPATH `gawk -v x': invalid alias name
    bash: alias: gawkpath_prepend: not found
    bash: alias: `if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH ': invalid alias name
    bash: alias: gawkpath_append: not found
    bash: alias: `if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH ': invalid alias name
    bash: alias: gawklibpath_default: not found
    bash: alias: `unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x': invalid alias name
    bash: alias: gawklibpath_prepend: not found
    bash: alias: `if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH ': invalid alias name
    bash: alias: gawklibpath_append: not found
    bash: alias: `if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH ': invalid alias name
    werner@X10DAi:~$ . /etc/profile.d/vte.csh
    bash: vte.csh.save: line 19: syntax error near unexpected token `!'
    bash: vte.csh.save: line 19: `if ( ! $?prompt | ! $?tcsh | ! $?TERM | ! $?VTE_VERSION ) exit'

    Below are the contents of the above scripts:

    werner@X10DAi:~$ cat debuginfod.csh
    # $HOME/.login* or similar files may first set $DEBUGINFOD_URLS.
    # If $DEBUGINFOD_URLS is not set there, we set it from system *.url files. # $HOME/.*rc or similar files may then amend $DEBUGINFOD_URLS.
    # See also [man debuginfod-client-config] for other environment variables # such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.

    if (! $?DEBUGINFOD_URLS) then
    set prefix="/usr"
    set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls; :' "/etc/debuginfod" 2>/dev/null | tr '\n' ' '`
    if ( "$DEBUGINFOD_URLS" != "" ) then
    setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
    else
    unset DEBUGINFOD_URLS
    endif
    unset prefix
    endif

    werner@X10DAi:~$ cat gawk.csh.save
    alias gawkpath_default 'unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`'

    alias gawkpath_prepend 'if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH == "") then; unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKPATH "\!*"":$AWKPATH"'

    alias gawkpath_append 'if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH == "") then; unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKPATH "$AWKPATH"":\!*"'

    alias gawklibpath_default 'unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`'

    alias gawklibpath_prepend 'if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH == "") then; unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKLIBPATH "\!*"":$AWKLIBPATH"'

    alias gawklibpath_append 'if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH == "") then; unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKLIBPATH "$AWKLIBPATH"":\!*"'

    werner@X10DAi:~$ cat vte.csh.save
    # Copyright © 2019 Red Hat, Inc.
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program. If not, see <https://www.gnu.org/licenses/>.
    #
    # Red Hat Author(s): Carlos Santos

    # exit if non-interactive, csh, no terminal or old VTE versions
    if ( ! $?prompt | ! $?tcsh | ! $?TERM | ! $?VTE_VERSION ) exit

    switch($TERM)
    case xterm*:
    alias precmd 'echo -n "\e]7;file://$HOST"; /usr/libexec/vte-urlencode-cwd; echo -n "\e\\"'
    endsw


    I'm not familiar with these csh syntax in them. Any tips to fix these problems?

    Regards,
    Zhao




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jmccue@neutron.hsd1.ma.comcast.net@21:1/5 to hongy...@gmail.com on Mon Mar 6 04:44:08 2023
    hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
    On Ubuntu 22.10, I noticed that some system shipped
    environments initialization scripts have syntax or logic errors as follows:

    <snip>

    I was having hard time reading your post due it formatting
    and I am very tied now. I do not know where the scripts
    begin/end, maybe put each script in their own pastebin type
    URL.

    But a quick look at thss line for csh
    set DEBUGINFOD_URLS=.....
    is wrong, it seems to be using the '2>'
    which is invalid for csh

    I suggest you contact the distro maintainer of the scripts,
    maybe file a bug report.

    --
    [t]csh(1) - "An elegant shell, for a more... civilized age."
    - Paraphrasing Star Wars

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Keith Thompson@21:1/5 to jmccue@neutron.hsd1.ma.comcast.net on Sun Mar 5 20:49:15 2023
    <jmccue@neutron.hsd1.ma.comcast.net> writes:
    hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
    On Ubuntu 22.10, I noticed that some system shipped
    environments initialization scripts have syntax or logic errors as follows: >>
    <snip>

    I was having hard time reading your post due it formatting
    and I am very tied now. I do not know where the scripts
    begin/end, maybe put each script in their own pastebin type
    URL.

    But a quick look at thss line for csh
    set DEBUGINFOD_URLS=.....
    is wrong, it seems to be using the '2>'
    which is invalid for csh

    The line in question is:

    set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls; :' "/etc/debuginfod" 2>/dev/null | tr '\n' ' '`

    The "2>" is part of a string passed to sh to be executed.

    I suggest you contact the distro maintainer of the scripts,
    maybe file a bug report.

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for XCOM Labs
    void Void(void) { Void(); } /* The recursive call of the void */

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Keith Thompson@21:1/5 to Keith Thompson on Sun Mar 5 20:51:12 2023
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
    <jmccue@neutron.hsd1.ma.comcast.net> writes:
    hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
    On Ubuntu 22.10, I noticed that some system shipped
    environments initialization scripts have syntax or logic errors as follows: >>>
    <snip>

    I was having hard time reading your post due it formatting
    and I am very tied now. I do not know where the scripts
    begin/end, maybe put each script in their own pastebin type
    URL.

    But a quick look at thss line for csh
    set DEBUGINFOD_URLS=.....
    is wrong, it seems to be using the '2>'
    which is invalid for csh

    The line in question is:

    set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls; :' "/etc/debuginfod" 2>/dev/null | tr '\n' ' '`

    The "2>" is part of a string passed to sh to be executed.

    I suggest you contact the distro maintainer of the scripts,
    maybe file a bug report.

    And if you look at the parent article, you'll note that the OP was
    invoking a csh script from bash, so of course it's going to have errors.
    This was already pointed out more than a month ago.

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for XCOM Labs
    void Void(void) { Void(); } /* The recursive call of the void */

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)