gjs-console doesn't quote arguments, breaking gnome-shell-clock-preferences

Bug #646877 reported by Delan Azabani
34
This bug affects 6 people
Affects Status Importance Assigned to Milestone
gjs (Ubuntu)
Fix Released
Medium
Unassigned
Nominated for Maverick by Delan Azabani

Bug Description

With Gnome 3's gnome-shell installed, opening clock preferences fails:

delan@delan:~$ gnome-shell-clock-preferences
      JS LOG: Command line: /usr/bin/gjs-console.real ClockPreferences = imports.prefs.clockPreferences; ClockPreferences.main({ progName: 'gnome-shell-clock-preferences', uiFile: '/usr/share/gnome-shell/clock-preferences.ui', localeDir: '/usr/share/locale' });
    JS ERROR: !!! Exception was: SyntaxError: missing variable name
    JS ERROR: !!! lineNumber = '1'
    JS ERROR: !!! fileName = '<command line>'
    JS ERROR: !!! stack = ''
    JS ERROR: !!! message = 'missing variable name'
SyntaxError: missing variable name
---
Architecture: amd64
DistroRelease: Ubuntu 10.10
NonfreeKernelModules: nvidia
Package: gnome-shell 2.31.5-2ubuntu2
PackageArchitecture: amd64
ProcEnviron:
 LANGUAGE=en
 PATH=(custom, user)
 LANG=en_AU.utf8
 SHELL=/bin/bash
Tags: maverick
Uname: Linux 2.6.36-020636rc5-generic x86_64
UserGroups: adm admin audio cdrom dialout dip fax floppy fuse lpadmin netdev plugdev sambashare sudo tape video www-data

Related branches

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

Hello Delan
Can you please run in a terminal
apport-collect -p gnome-shell 646877
Thanks
Fabio

affects: ubuntu → gnome-shell (Ubuntu)
Changed in gnome-shell (Ubuntu):
status: New → Incomplete
Revision history for this message
Delan Azabani (azabani) wrote : Dependencies.txt

apport information

tags: added: apport-collected
description: updated
Revision history for this message
Fabio Marconi (fabiomarconi) wrote : Re: Gnome 3's gnome-shell-clock-preferences doesn't launch

Thanks for reporting this bug and any supporting documentation. Since this bug has enough information provided for a developer to begin work, I'm going to mark it as confirmed and let them handle it from here. Thanks for taking the time to make Ubuntu better!

Changed in gnome-shell (Ubuntu):
status: Incomplete → Confirmed
tags: added: amd64 maverick
Revision history for this message
Delan Azabani (azabani) wrote :

This bug is fairly important, though not a blocker. If the images are already being made, we won't be able to slip an update in, though we could place an online update within the first few days of release. I have some JavaScript knowledge, so I'll take a look and see what I can do.

Revision history for this message
Delan Azabani (azabani) wrote :

Okay, here's the problem. Running gjs-console calls gjs-console.real, but then only runs the first 'word' as JavaScript because the arguments don't stay quoted. The rest is lost to other command line arguments. For example, in gnome-shell-clock-preferences:

    /usr/bin/gjs-console -c "const ClockPreferences = ..."

The above call turns into this:

    /usr/bin/gjs-console.real -c const ClockPreferences = ...

As you can see, -c is now just "const" (obviously wrong) because of the quoting dropped. I'm about to submit a patch to /usr/bin/gjs-console that changes this line:

    exec /usr/bin/gjs-console.real $@

to this:

    exec /usr/bin/gjs-console.real "$@"

which fixes the problem.

Revision history for this message
Delan Azabani (azabani) wrote :
Changed in gnome-shell:
status: New → Confirmed
assignee: nobody → Delan Azabani (delan-azabani)
Changed in gnome-shell (Ubuntu):
assignee: nobody → Delan Azabani (delan-azabani)
Revision history for this message
Delan Azabani (azabani) wrote :

reported bug upstream

Changed in gnome-shell:
assignee: Delan Azabani (delan-azabani) → nobody
importance: Undecided → Unknown
status: Confirmed → Unknown
Revision history for this message
Delan Azabani (azabani) wrote :
affects: gnome-shell (Ubuntu) → gjs (Ubuntu)
Changed in gjs (Ubuntu):
status: Confirmed → In Progress
affects: gnome-shell → gjs
summary: - Gnome 3's gnome-shell-clock-preferences doesn't launch
+ Gnome 3's gjs-console doesn't quote arguments, breaking gnome-shell-
+ clock-preferences
Revision history for this message
Micah Gersten (micahg) wrote :

This is not an upstream issue. The wrapper is Ubuntu specific. Also, your patch doesn't do what you think it should.

summary: - Gnome 3's gjs-console doesn't quote arguments, breaking gnome-shell-
- clock-preferences
+ gjs-console doesn't quote arguments, breaking gnome-shell-clock-
+ preferences
Revision history for this message
Delan Azabani (azabani) wrote :

Okay then. About the patch, it works for me; why doesn't it do what it should?

Changed in gjs:
importance: Unknown → Undecided
status: Unknown → New
Revision history for this message
Micah Gersten (micahg) wrote :

I don't think it quotes the individual arguments.

Revision history for this message
Delan Azabani (azabani) wrote :

That's what I thought too. However, according to bash(1),

    @ Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, each parameter expands to a separate word. That is, "$@" is equivalent to "$1" "$2" ... If the double-quoted expansion occurs within a word, the expansion of the first parameter is joined with the beginning part of the original word, and the expansion of the last parameter is joined with the last part of the original word. When there are no positional parameters, "$@" and $@ expand to nothing (i.e., they are removed).

and, specifically, this,

    That is, "$@" is equivalent to "$1" "$2" ...

Revision history for this message
Delan Azabani (azabani) wrote :

debdiff submitted; all ready to go.

Revision history for this message
Delan Azabani (azabani) wrote :

By the way, please let me know if I've done something wrong; this is my first time actually fixing a bug or making patches.

Revision history for this message
Micah Gersten (micahg) wrote :

Debdiff looks good, thanks, I'll upload as soon as I can get it in

affects: gjs → null
Changed in gjs (Ubuntu):
importance: Undecided → Medium
assignee: Delan Azabani (delan-azabani) → Micah Gersten (micahg)
Revision history for this message
Micah Gersten (micahg) wrote :

Uploaded, thanks for the work on this.

Changed in gjs (Ubuntu):
assignee: Micah Gersten (micahg) → nobody
status: In Progress → Fix Committed
Revision history for this message
Delan Azabani (azabani) wrote :

No problem, happy to help.

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

This bug was fixed in the package gjs - 0.7.1-1ubuntu4

---------------
gjs (0.7.1-1ubuntu4) maverick; urgency=low

  * fix LP: #646877 - wrap $@ with double quotes in gjs-console so that
    commands passed to gjs-console.real stay intact
 -- Delan Azabani <email address hidden> Fri, 08 Oct 2010 12:30:04 +0800

Changed in gjs (Ubuntu):
status: Fix Committed → Fix Released
Curtis Hovey (sinzui)
no longer affects: null
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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