After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 170058 - bzip2 location hardcoded
bzip2 location hardcoded
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: [obsolete] theme-manager
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
: 170150 301788 337269 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-03-12 12:40 UTC by Matt Kynx
Modified: 2006-04-11 10:01 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
Check /bin/bzip2 (1.27 KB, patch)
2005-03-12 13:29 UTC, David Sedeño Fernández
needs-work Details | Review
fix hardcoded paths (6.51 KB, patch)
2005-05-26 16:26 UTC, Daniel Gryniewicz
accepted-commit_now Details | Review
Set the correct paths and cleanup the process (12.14 KB, patch)
2005-06-02 21:54 UTC, David Sedeño Fernández
none Details | Review
More work in the patch (17.53 KB, patch)
2005-06-04 21:34 UTC, David Sedeño Fernández
none Details | Review
Remove access func. for gnome-vfs calls (19.79 KB, patch)
2005-06-05 12:42 UTC, David Sedeño Fernández
none Details | Review

Description Matt Kynx 2005-03-12 12:40:30 UTC
Version details:  
Distribution/Version: Gentoo (gnome-2.10.0_pre0 ebuilds)

Steps to reproduce:
1. Select Desktop > Preferences > Themes
2. Click on Install Theme
3. Browse for bz2 theme
4. Click Open and Install

Actual:
Error message: "Cannot install theme. The bzip2 utility is not installed"

Expected:
Theme is installed

Additional info:
bzip2 is installed to /bin/bzip2, not /usr/bin/bzip2 on my system (Gentoo
Linux). The /bin/bzip2 location is hardcoded in:
gnome-control-center/capplets/theme-switcher/gnome-theme-installer.c

Quick workaround:
symlink /usr/bin/bzip2 -> /bin/bzip2
Comment 1 David Sedeño Fernández 2005-03-12 13:29:54 UTC
Created attachment 38590 [details] [review]
Check /bin/bzip2
Comment 2 Matt Kynx 2005-03-12 16:23:50 UTC
Uh, well, yeah, I guess that would stop the error message. But don't think it'll
actually make it work...

$ grep -n /usr/bin/bzip2 gnome-theme-installer.c
179:    command = g_strdup_printf ("sh -c 'cd \"%s\"; /usr/bin/bzip2 -d -c <
\"%s\" | /bin/tar xf - '",
218:            command = g_strdup_printf ("sh -c '/usr/bin/bzip2 -d -c < \"%s\"
| /bin/tar ft - | head -1'",
257:            if (!g_file_test ("/usr/bin/bzip2", G_FILE_TEST_EXISTS)) {


 
Comment 3 Matt Kynx 2005-03-12 18:09:42 UTC
I've submitted at patch for the Gentoo packages at:
http://bugs.gentoo.org/show_bug.cgi?id=84997
Comment 4 Sebastien Bacher 2005-03-13 13:34:56 UTC
*** Bug 170150 has been marked as a duplicate of this bug. ***
Comment 5 David Sedeño Fernández 2005-05-16 14:31:08 UTC
*** Bug 301788 has been marked as a duplicate of this bug. ***
Comment 6 Sebastien Bacher 2005-05-22 16:09:59 UTC
as mentionned by comment #2, that doesn't fix the issue
Comment 7 Paolo Borelli 2005-05-23 13:04:36 UTC
the proper solution would probably be to use g_find_program_in_path. The same
should also be done for tar.
Comment 8 Daniel Gryniewicz 2005-05-26 16:26:09 UTC
Created attachment 46910 [details] [review]
fix hardcoded paths

Here is the proposed fix that's going into Gentoo.  It replaces all the
hardcoded paths with g_find_program_in_path() calls.
Comment 9 Paolo Borelli 2005-05-26 16:52:05 UTC
I'm not the maintainer, but from a quick look the patch looks ok for a quick fix
of this bug... however the whole code in there seems quite scary to me... for
instance why the utilities have to be located more than once? In fact why are
the commands run twice at all (once in the function and once in the idle
handlers)? Even worse those are not idle handlers anymore and the function name
and the comments are just misleading!

I can also spot various other issues... like the use of the access() function to
test the exitence of directories which is racy and insecure by nature...

David, by looking at the cvs commit logs it looks like you were the one
reworking this code, can you fix things up a bit?
Comment 10 Daniel Gryniewicz 2005-05-26 19:21:27 UTC
Yes, I noticed some problems with the code, and had some others pointed out to
me when I got it reviewed by other Gentoo Gnome herd members, but I think that
kind of extensive rework is beyond the scope of a bugfix for 2.10.1.  I'm going
to look into general cleanup against HEAD, but someone more familiar with the
code could probably do a better job.
Comment 11 David Sedeño Fernández 2005-06-02 19:51:47 UTC
I'm working on a patch to clean up the file a bit. Let me some time to come with
something useful.

Comment 12 David Sedeño Fernández 2005-06-02 21:54:20 UTC
Created attachment 47166 [details] [review]
Set the correct paths and cleanup the process
Comment 13 David Sedeño Fernández 2005-06-02 21:56:00 UTC
Paolo: There are two command but one of them not uncompress the file (it have a
| head -1), it's only to see the name of the dir. I will try to fix this too and
get this info from the uncompressed dir.
Comment 14 Paolo Borelli 2005-06-02 22:06:58 UTC
ok, thanks for looking into this... just glanced at the patch, but it doesn't
seem to adress all of my points: 

- access() is still there, really don't use it
- transfer_done_targz_idle_cb is not an idle handler at all afaics so it must be
renamed. Beside bzip_idle_cb is almost the same function... can't they be
combined? Also remove the misleading stale comments about idle handlers
- I seem to recall that there are cases where the code tries to write in
~/.themes without making sure that the directory exists
- don't use "\n" inside the error messages, use the primary and secondary text
labels
- maybe other stuff (I'm going by memory, haven't checked the code
Comment 15 David Sedeño Fernández 2005-06-04 21:34:05 UTC
Created attachment 47243 [details] [review]
More work in the patch

Paolo: I have comined the two funtions, use the primary and secondary text for
the dialog and remove some comments.

The access call was there before my patch ;) but, what function we must use
instead?
Comment 16 Paolo Borelli 2005-06-05 10:02:27 UTC
You just try to open it and handle the error if it doesn't exits or cannot be
opened. The problem with access() is that it is racy:

- program 1 calls access() of foo
- program 1 is put to sleep by the kernel
- program 2 removes foo
- program 1 is screwed because it has wrong information on the current state of foo
Comment 17 David Sedeño Fernández 2005-06-05 12:42:10 UTC
Created attachment 47267 [details] [review]
Remove access func. for gnome-vfs calls

The access call it's checking the permission of .themes directory. I have
replaced this call with gnome-vfs get info call.
Comment 18 David Sedeño Fernández 2005-06-11 19:18:10 UTC
I'm trying to detect errors after g_spawn_command_line_sync but I don't know how
because the command returns 0 in status var when there are a problem with
permission for example.

Comment 19 Dennis Krul (dweazle) 2005-08-18 12:18:55 UTC
Changing status

Comment 20 pholie 2005-12-20 18:19:57 UTC
Hey, is that so hard? It's december already. I have it in /bin/bzip2 and it can't find it. The funny part is, tar and gzip are there too and it has no problems with tar.gz themes. Gnome 2.12
Comment 21 Luca Cavalli 2006-04-04 22:14:40 UTC
*** Bug 337269 has been marked as a duplicate of this bug. ***
Comment 22 Thomas Wood 2006-04-09 17:44:41 UTC
Was there actually any issue with patch #46910 (fix hardcoded paths)? If not then I will apply it.

I think the problem the gnome-vfs patch is trying to address is a separate issue.
Comment 23 Sebastien Bacher 2006-04-10 10:13:57 UTC
Thomas, that change looks fine from a quick glance, feel free to commit if you try it with one archive of each sort and it still works fine with the change
Comment 24 Thomas Wood 2006-04-10 19:08:33 UTC
2006-04-10  Thomas Wood  <thos@gnome.org>

        * gnome-theme-installer.c: (transfer_done_targz_idle_cb),
        (transfer_done_tarbz2_idle_cb), (transfer_done_cb): Applied patch from
        bug 170058 - bzip2 location hardcoded

Comment 25 Paolo Borelli 2006-04-10 19:12:23 UTC
this bug is far from fixed... that code is crappy to say the least and the patch that was committed is a bandaid.

Closing this bug is just sweeping dirt under the carpet, throwing away many useful comments and remarks accumulated in this bug and also throwing away some patches that even if not 100% ready are a step forward.
Comment 26 Thomas Wood 2006-04-11 10:01:13 UTC
I agree with comment #9 that the theme install code is a mess, and needs clearing up. However, that was not the purpose of this bug report. The issue this bug was opened for was to fix the hardcoded location of the bzip2 program. The comitted patch did this (and also for gzip and tar), so the issue the bug was opened for has been resolved. Please feel free to open another bug report to address the state of the theme install code.