Temporary SOLUTION:

I've found another workaround. Unfortunately for us this doesn't seems
to be a bug, at least I guess there's no intention from gnome developers
to solve it soon:

A upstream developer said: "You shouldn't start GNOME programmes with
elevated privileges, it's not supported. In any case, not a gnome-
terminal bug". It's not just nautilus it's any gnome application with a
GUI.

This can be confirmed according to the upstream of the Nautilus bug,
https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/805682, at Gnome
bugzilla (https://bugzilla.gnome.org/show_bug.cgi?id=654184). It's clear
that Gnome developers don't design their programs to be runned as root.

So, since they don't want to support gnome graphical programs as root, it's not 
a bug. If you can read more about why they don't support this you can read:
- http://ubuntuforums.org/showthread.php?t=2014450
- https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1019995


But it IS a problem if we want to start gnome graphical programs as root. So we 
need alternative solutions:

- Paddy Landau have created a workaround for it (comment #20) and posted it at 
http://ubuntuforums.org/showpost.php?p=12071894&postcount=81.
- You can use alternative applications (like graphical leafpad or vim and nando 
in the terminal).
- Running sudo gedit (NOT recommended, graphical programs should be runned with 
gksudo or kdesudo)
- The simplest solution I got. (See down).


As Derek White posted in
https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/890041.

$ gedit # opens untitled document
$ gedit /path/to/file # opens file
$ sudo gedit /path/to/file # opens file
$ gksu gedit /path/to/file # opens file & untitled document
$ gksudo gedit /path/to/file # opens file & untitled document

I figured out that it only happens when you try to gksudo with other
user. For example:

$ gksudo -u userA /path/to/file # Will opens file normally if logged as userA.
$ gksudo /path/to/file # Will also opens normally if you're logged as root 
(with sudo -i or something).

But if you are root and try to gksudo with other user it will brings the
untitled document again:

$ gksudo -u UserA /path/to/file # Will opens file & untitled document.

So, as long as we are supossed to run graphical applications with
gksudo, the solution is to be logged as root and run gedit with gksudo
(whitout parameters it'll run as root). If you want to do this in one
single line you can do:

$ sudo gksudo gedit /path/to/file # Works perfectly.
$ gksudo gksudo gedit /path/to/file # Works perfectly. I recomend this, 
specially if you want to call gedit in a script or something.

That's it!

I wish this can help to devs to deciding fix this problem an support
graphical as root. Or someone else to add the feature to Gnome
applications.

** Bug watch added: GNOME Bug Tracker #654184
   https://bugzilla.gnome.org/show_bug.cgi?id=654184

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to gedit in Ubuntu.
https://bugs.launchpad.net/bugs/796076

Title:
  When run as root [gksudo gedit <whatever>]  gedit  tries to open a 2nd
  'untitled document 1'

Status in Light-Weight Text Editor for Gnome:
  New
Status in “gedit” package in Ubuntu:
  Triaged

Bug description:
  Binary package hint: gedit

  Ex.
  gksudo gedit /etc/fstab will open fstab successfully but will also try to 
open "Untitled Document 1" at the same time
  If just running gksudo gedit than you'll get "Untitled Document 1" that never 
does fully open (become writable

  == Regression details ==
  Discovered in version: 3.0.4-0ubuntu2
  Last known good version: 2.30.4-2ubuntu1

  ProblemType: Bug
  DistroRelease: Ubuntu 11.10
  Package: gedit 3.0.4-0ubuntu2 [modified: usr/share/applications/gedit.desktop]
  ProcVersionSignature: Ubuntu 2.6.38-9.43lp760131v201106060906-generic 2.6.38.7
  Uname: Linux 2.6.38-9-generic i686
  NonfreeKernelModules: nvidia
  Architecture: i386
  Date: Sat Jun 11 19:11:08 2011
  InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
  ProcEnviron:
   LANGUAGE=en_US:en
   PATH=(custom, user)
   LANG=en_US.utf8
   LC_MESSAGES=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: gedit
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/gedit/+bug/796076/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to