Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fix the error in some csh scripts.

18 views
Skip to first unread message

hongy...@gmail.com

unread,
Jan 30, 2023, 1:54:01 AM1/30/23
to
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



Janis Papanagnou

unread,
Jan 30, 2023, 2:53:00 AM1/30/23
to
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

Jalen Q

unread,
Mar 5, 2023, 7:51:07 PM3/5/23
to

jmc...@neutron.hsd1.ma.comcast.net

unread,
Mar 5, 2023, 11:44:13 PM3/5/23
to
hongy...@gmail.com <hongy...@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

Keith Thompson

unread,
Mar 5, 2023, 11:49:21 PM3/5/23
to
<jmc...@neutron.hsd1.ma.comcast.net> writes:
> hongy...@gmail.com <hongy...@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.T...@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */

Keith Thompson

unread,
Mar 5, 2023, 11:51:17 PM3/5/23
to
Keith Thompson <Keith.S.T...@gmail.com> writes:
> <jmc...@neutron.hsd1.ma.comcast.net> writes:
>> hongy...@gmail.com <hongy...@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.
0 new messages