Opening by custom command line in terminal emulator does not work

Bug #1414822 reported by Jarno Suni
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pcmanfm (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Steps to reproduce:

You set terminal emulator in preferences > advanced
lxterminal -T '%s' -e "/bin/bash -c '%s'"
(provided that pcmanfm adds no quotes around the input string)
or
lxterminal -T %s -e "/bin/bash -c %s"
(provided that pcmanfm adds single quotes around the input string)
or
lxterminal -T %s -e '/bin/bash -c %s'
(provided that pcmanfm adds double quotes around the input string)

lxterminal can be replaced by xfce4-terminal above. Additonally, with xfce4-terminal, one could use
xfce4-terminal -T %s -x /bin/bash -c %s
(provided that pcmanfm adds single or double quotes around the input string)

Then try to open a text file by custom command "cat %f | less".

It fails to run the command in terminal and give the title for the terminal window.

If the file (%f) selected in the file manager was named 'foo bar', and lxterminal was used in the preferences, the expected outcome would be the same as what is the outcome of running the command
lxterminal -T 'cat foo\ bar | less' -e "/bin/bash -c 'cat foo\ bar | less'"
in terminal emulator.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: pcmanfm 1.2.0-1
ProcVersionSignature: Ubuntu 3.13.0-44.73-lowlatency 3.13.11-ckt12
Uname: Linux 3.13.0-44-lowlatency x86_64
ApportVersion: 2.14.1-0ubuntu3.6
Architecture: amd64
Config_pcmanfm_System_ubuntustudio: Error: [Errno 2] No such file or directory: '/etc/xdg/pcmanfm/ubuntustudio/pcmanfm.conf'
CurrentDesktop: XFCE
Date: Mon Jan 26 15:36:37 2015
EcryptfsInUse: Yes
InstallationDate: Installed on 2014-09-21 (127 days ago)
InstallationMedia: Ubuntu-Studio 14.04.1 LTS "Trusty Tahr" - Release amd64 (20140722.1)
SourcePackage: pcmanfm
Udisks_dump: Error: [Errno 2] No such file or directory: 'udisks'
UpgradeStatus: No upgrade log present (probably fresh install)

Versions affected: trusty, vivid
pcmanfm versions: 1.2.0-1, 1.2.3-1.1

Revision history for this message
Jarno Suni (jarnos) wrote :
Revision history for this message
Dave Kokandy (drkokandy) wrote :

Thank you for taking the time to report this error and improve Ubuntu. You have marked this as a PCManFM bug, but this appears to only affect LXTerminal. In fact, it seems to be very similar or a duplicate of an existing bug which causes the title flag in LXTerminal not to work: https://bugs.launchpad.net/ubuntu/+source/lxterminal/+bug/1389588

Would you please submit version information for LXTerminal, rather than PCManFM? You can run "apt-cache policy lxterminal" to collect this information.

affects: pcmanfm (Ubuntu) → lxterminal (Ubuntu)
Jarno Suni (jarnos)
description: updated
Revision history for this message
Jarno Suni (jarnos) wrote :

It seems you did not check this. Similar failure happens with xfce4-terminal, as well. And e.g. running
lxterminal -T "Custom Title" -e "/bin/bash -c 'read'"
in terminal works fine. The problem is only, if you run it using pcmanfm's terminal emulator preference. The command fails even if you remove the title option. However, setting terminal emulator
lxterminal -T "Static Title" -e %s
works, but it it does different thing.

Revision history for this message
Jarno Suni (jarnos) wrote :

So the bug is in how pcmanfm handles the %s parameter (which is undocumented in the user interface, by the way).

affects: lxterminal (Ubuntu) → pcmanfm (Ubuntu)
Jarno Suni (jarnos)
description: updated
Jarno Suni (jarnos)
description: updated
Revision history for this message
Dave Kokandy (drkokandy) wrote :

Thank you for the additional information. I attempted to test and verify it, but since your original report was unclear that we were talking about a feature in PCManFM, I was testing the wrong thing.

Especially seeing as this is an undocumented feature, can you clearly explain your expected outcome?

Also, has this ever worked in a previous version?

With that information, I may be better able to try to reproduce this bug.

Jarno Suni (jarnos)
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in pcmanfm (Ubuntu):
status: New → Confirmed
Revision history for this message
Dave Kokandy (drkokandy) wrote :

There is something strange going on here, but I think it requires additional testing to identify the exact issue. With the Terminal emulator set in PCManFM's Preferences > Advanced set to lxterminal -T %s -e '/bin/bash -c %s' like you say, your custom command: "cat %f | less" fails on my machine as well. A terminal seems to pop open, but either nothing happens or happens so fast I cannot see it.

Other custom commands, for instance, "vi %f" or "nano %f" work perfectly. However, "less %f" fails.

Revision history for this message
Dave Kokandy (drkokandy) wrote :
description: updated
Revision history for this message
Jarno Suni (jarnos) wrote :

It does not help, if you tick "Keep terminal window open after command execution". Given the file was "foo bar", even "nano %f" did not work in the case above: It opens file named ./foo first and then it opens file named bar; even quoting %f in the command does not help. However, if the terminal setting was changed to be
xfce4-terminal -T %s -x /bin/bash -c %s
then "nano %f" and "less %f" works with "foo bar" except the title. "cat %f | less" does not work even then.

Revision history for this message
LStranger (andrej-rep) wrote :

What interesting discussion you have here... :)
In fact, using some "%s" in interpreted line is a security hole which is why it was reworked long time ago. Now in LibFM (PCManFM) any % in 'terminal' setting is ignored, along with everything behind it. So if you set it to
  xfce4-terminal -T %s -x /bin/bash -c %s
then real command will be executed either
  xfce4-terminal -T -x <your command>
or
  xfce4-terminal -T --hold -x <your command>
depending on have you set don't-close-terminal-window flag or not.
Next time don't rely on temporary undocumented features, please.
If you need some feature then just come to upstream features tracker and write it down there. Chances are big enough it would be implemented in next major release.

Whoever responsible for this tracker, please, close this bug as invalid one. Thank you. :)

Revision history for this message
LStranger (andrej-rep) wrote :

Oh, even not that, I've missed the point, -X before % is ignored too (for backward support of 'xterm -e %s') therefore in lines above '-T' wouldn't be present too, just xfce4-terminal -x <your command> will be executed or whatever.

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.