Bug 1333523

Summary: Quoted backslashes gets repeated when taken from history
Product: [Fedora] Fedora Reporter: Göran Uddeborg <goeran>
Component: tcshAssignee: David Kaspar // Dee'Kej <deekej>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: high    
Version: 24CC: deekej, fpokorny, jchaloup, jfrieben, kdudka, ovasik, praiskup, pschindl, rkollar
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tcsh-6.19.00-8.fc24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1334751 (view as bug list) Environment:
Last Closed: 2016-05-20 17:37:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1319816, 1334751    
Attachments:
Description Flags
proposed-patch deekej: review-

Description Göran Uddeborg 2016-05-05 18:02:22 UTC
Description of problem:
If a command has a backslash within quotes, and that command is brought back with e.g. "up-history", the backslash is doubled.

Version-Release number of selected component (if applicable):
tcsh-6.19.00-7.fc24.x86_64


How reproducible:
Every time


Steps to Reproduce:
1. echo '\n'
2. <Up> (or ctrl-p)


Actual results:
The line says: echo '\\n'


Expected results:
A line saying: echo '\n'

Comment 1 Pavel Raiskup 2016-05-06 05:19:05 UTC
Göran, I'm not able to reproduce this (f24 mock with 6.19.00-7).  Seems like
there is some missing step in the reproducer?

Comment 2 Joachim Frieben 2016-05-06 06:39:28 UTC
(In reply to Pavel Raiskup from comment #1)
Just type "\" followed by <Enter> and recall the (last) command using the history function.

Comment 3 Kamil Dudka 2016-05-06 08:07:46 UTC
I am able to reproduce it on f23 if I just compile the f24 version of tcsh:

kdudka@f23 ~/fedora/tcsh/tcsh-6.19.00 $ ./tcsh 
[kdudka@f23 tcsh-6.19.00]$ echo '\n'


[kdudka@f23 tcsh-6.19.00]$ echo '\\n'



After commenting out tcsh-6.19.00-026-quote-backslashes-properly.patch, the bug is no longer reproducible:

kdudka@f23 ~/fedora/tcsh/tcsh-6.19.00 $ ./tcsh 
[kdudka@f23 tcsh-6.19.00]$ echo '\n'


[kdudka@f23 tcsh-6.19.00]$ echo '\n'

Comment 4 Göran Uddeborg 2016-05-06 20:44:06 UTC
Pawel, did the examples from Joachim and Kamil help you to reproduce?  If not, and to be very explicit, these are the keys I type in my example

e c h o SPACE ' \ n ' ENTER UP-ARROW

If you do the same, do you see one or two backslashes?

To be on  the safe side, I tried it in a shell started with the -f flag, and I could still reproduce it.

Comment 5 Pavel Raiskup 2016-05-09 07:05:15 UTC
Ah, sorry - it is clearly reproducible:

  $ mock -r fedora-rawhide-x86_64 --install tcsh
  $ mock -r fedora-rawhide-x86_64 --shell
  <mock-chroot> sh-4.3# tcsh
  [root@nb /]# echo '\n'

  [root@nb /]# echo '\\n'
  \n
  [root@nb /]# echo '\\\\n'
  \\n
  [root@nb /]# echo '\\\\\\\\n'
  \\\\n

Comment 6 David Kaspar // Dee'Kej 2016-05-10 12:50:10 UTC
I have already informed upstream about this:
http://mx.gw.com/pipermail/tcsh-bugs/2016-May/001043.html

Comment 7 David Kaspar // Dee'Kej 2016-05-10 12:54:47 UTC
Created attachment 1155760 [details]
proposed-patch

The patch seems to be an EasyFix (one liner). It fixes the regression, testsuite passes, as well as the testcase for the initial issue.

Comment 8 David Kaspar // Dee'Kej 2016-05-16 11:19:03 UTC
Upstream has published fix for this regression:
https://github.com/tcsh-org/tcsh/commit/d52d669405da

I have already included the changes in Rawhide & F24:
http://pkgs.fedoraproject.org/cgit/rpms/tcsh.git/commit/?d=4fa96ac1048b5f5a

New package build is on the way, so stay tuned! ;)

Comment 9 Fedora Update System 2016-05-16 12:14:42 UTC
tcsh-6.19.00-8.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-16167118e0

Comment 10 David Kaspar // Dee'Kej 2016-05-16 13:20:34 UTC
Comment on attachment 1155760 [details]
proposed-patch

Upstream fixed the issue in different part of source code.

Comment 11 Fedora Update System 2016-05-16 23:55:57 UTC
tcsh-6.19.00-8.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-16167118e0

Comment 12 Petr Schindler 2016-05-20 08:18:15 UTC
tcsh 6.19.00-8.fc24 fixes this bug.

Comment 13 Fedora Update System 2016-05-20 17:37:14 UTC
tcsh-6.19.00-8.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.