tcsh subshell escaping broken

Bug #1706223 reported by Anatoly Borodin
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Midnight Commander
Fix Released
Unknown
mc (Ubuntu)
Confirmed
Undecided
Unassigned
tcsh (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Release: Ubuntu 17.04 Zesty
tcsh version: 6.20.00-7

I’m trying to fix the integration between mc and the recent version of
tcsh (as a subshell) that got broken in Ubuntu 17.04 Zesty. I have
noticed that the escaping has been changed in the commit
https://github.com/tcsh-org/tcsh/commit/c445a078a7b124fd86dd6eba9c076476b8e757d4,
that can be tested with

mkdir -p '/tmp/a b' && ls -d "`printf "%b" '\0057tmp\0057a\0040b'`"

Before the commit:

/tmp/a b

(The same result in bash and zsh btw.)

After the commit:

ls: cannot access '/tmp/a': No such file or directory
ls: cannot access 'b': No such file or directory

Looks like a regression in the version 6.20.

Revision history for this message
Anatoly Borodin (anatoly.borodin) wrote :

I'm also trying to contact the upstream commit author Christos Zoulas, but he seems to be busy.

The website http://tcsh.org/ is down right now.

Revision history for this message
Anatoly Borodin (anatoly.borodin) wrote :

I'm sorry, actually the Christos have naswered my email, but it got into the spam folder. Let's see if we can get an upstream solution.

Revision history for this message
Anatoly Borodin (anatoly.borodin) wrote :

Christos explained that tcsh escaping is tricky, buggy, and "fixing" it in a proper way can break legacy scripts.

I propose to fix the problem on the Midnight Commander side instead. To prevent messages like 'Warning: Cannot change to /tmp/a b/c d..' and failure to cd to such directories when using mc with recent versions of tcsh (SHELL=/bin/tcsh), mc can be patched (src/subshell/common.c) the following way: %b should not be escaped (or escaped with single quotes), because there are no ambiguities. See the attached diff for an example. I've tested the patch with different shells: tcsh (both old and new), bash, zsh, fish.

I also propose pushing this patch to the upstream (https://github.com/MidnightCommander/mc), and I will contact the dev team correspondingly.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "mc.diff" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
summary: - Escaping broken
+ tcsh subshell escaping broken
Changed in mc:
importance: Undecided → Unknown
status: New → Unknown
Changed in mc:
status: Unknown → New
Changed in mc:
status: New → Confirmed
tags: added: zesty
Revision history for this message
Anatoly Borodin (anatoly.borodin) wrote :

The issue has been fixed in https://github.com/MidnightCommander/mc/commit/0fec3ef449de6f22281161ba7af8f5dbb948292d , and is to appear in the next mc release (4.20).

Changed in mc:
status: Confirmed → Fix Released
Yury V. Zaytsev (zyv)
Changed in mc (Ubuntu):
status: New → Confirmed
Revision history for this message
dino99 (9d9) wrote :
Changed in tcsh (Ubuntu):
status: New → Invalid
Changed in mc (Ubuntu):
status: Confirmed → Invalid
Changed in mc (Ubuntu):
status: Invalid → Confirmed
Changed in tcsh (Ubuntu):
status: Invalid → New
Revision history for this message
Anatoly Borodin (anatoly.borodin) wrote :

dino99, why should this bug be marked as Invalid? The newer releases (Artful and Beaver-dev) are still (as of today) have the older version (3:4.8.19-1) of Midnight Commander without the patch (upstream release 4.8.20 of 25.11.2017). The newer releases just weren't released in July 2017.

PS I don't know about the plans of the MC packege maintainers at Debian. Is MC going to be updated in Beaver? Is it possible to port just the patch (it's trivial) to the Ubuntu package 3:4.8.19?

Revision history for this message
dino99 (9d9) wrote :

Request for archive upgrade:

https://midnight-commander.org/ (both Debian & Ubuntu still have 4.8.19)
' ppa:o9000/zulu ' (4.8.20) ' ppa:simonarons/ppa ' (4.8.20 +lbzip2)

Server down : https://github.com/tcsh-org/tcsh

tags: added: artful bionic upgrade-software-version
Revision history for this message
Anatoly Borodin (anatoly.borodin) wrote :

Thanks dino99!

Are any actions from me required?

Revision history for this message
dino99 (9d9) wrote :

Debian maintainer is now Thomas Lange; Seems Christos is now away from that project.
https://salsa.debian.org/debian/tcsh

Googling around tcsh lets me thinking tcsh is less used nowadays, replaced by bash and else.
But if you have suggestions, maybe Thomas could accept them.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in tcsh (Ubuntu):
status: New → Confirmed
tags: added: patchartful
removed: artful patch upgrade-software-version
tags: added: patch
removed: patchartful
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.