Text file with execute permission are opened in gedit

Bug #8042 reported by Santiago Erquicia
18
Affects Status Importance Assigned to Milestone
nautilus (Ubuntu)
Fix Released
Medium
Sebastien Bacher

Bug Description

I have a text file that it's a shell script with permission to be executed.
When I double-click over it, it is opened by gedit instead of being asked what
to do as the nautilus option is set.

Revision history for this message
Sebastien Bacher (seb128) wrote :

What's the mime-type of the file (properties in nautilus, or gnomevfs-info
file:///path/file) ?
What's the first line of the script ?

Revision history for this message
Santiago Erquicia (santiago-erquicia-gmail) wrote :

Through nautilus it says: application/x-shellscript

The file is called "ES key.sh" and this is its content: "setxkbmap -v -layout
la". That's the first and only line of the file.

This is the output of

santiago@pampa ~ $ gnomevfs-info file:///home/santiago/Desktop/ES\ key.sh
Name : ES key.sh
Type : Regular
MIME type : application/x-shellscript
Size : 24
Blocks : 2
I/O block size : 4096
Local : YES
SUID : NO
SGID : NO
Sticky : NO
Permissions : 1600700
Link count : 1
UID : 1000
GID : 1000
Access time : Thu Sep 16 10:42:19 2004
Modification time : Tue Aug 3 19:31:35 2004
Change time : Wed Sep 15 16:02:09 2004
Device # : 775
Inode # : 347900
Readable : YES
Writable : YES
Executable : YES

Revision history for this message
Santiago Erquicia (santiago-erquicia-gmail) wrote :

Created an attachment (id=77)
File in question

This is the file

Revision history for this message
Sebastien Bacher (seb128) wrote :

I can't reproduce the problem here. Are you the owner of the file (the
permissions are 700, you need to be the owner to have the +x right).

Revision history for this message
Santiago Erquicia (santiago-erquicia-gmail) wrote :

Yes, I'm the owner of the file. That's why gedit let me change the file without
any problem.

I don't know if will help but this file was created with Fedora Core 2. I had
other username in FC2 and I copied to my new username and then changed the
ownership running "sudo chown santiago:santiago *.*"

I created another file on my desktop from scratch and the same thing happens.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Ok, so if you do this:
* right click on the desktop -> Create Document -> Empty file
* name it test
* right click on it -> open with -> "gedit"
* enter "zenity --calendar"
* save and quit
* right click on the file -> properties -> permissions
* activate owner "execute"
* close
* double click on it

You don't get the "Run or Display ?" dialog ? (here it works)

Revision history for this message
Santiago Erquicia (santiago-erquicia-gmail) wrote :

In that case it works perfectly.

OK. I did one more experiment. I renamed my file from es.sh to only es and now
it works as it should. The only difference is that now the icon is not the SH
type but a blank document with the file content.

Revision history for this message
Sebastien Bacher (seb128) wrote :

ok, I've the problem on one box too with .sh extension, I'll dig into it, thanks
for the tests

Revision history for this message
Matt Zimmerman (mdz) wrote :

*** Bug 8075 has been marked as a duplicate of this bug. ***

Revision history for this message
Eugenia Loli-Queru (eloli) wrote :

I have problems with scripts too, but not just with the .sh extension, but
with any script! https://bugzilla.ubuntu.com/show_bug.cgi?id=1318
I am not sure if this is a duplicate or not, but it was marked as such.

Also, "nautilus scripts" don't work here anymore. Work great on Slackware.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Not sure if that's a dup. What's the mime type displayed in properties for these
files ?

BTW "nautilus scripts" works fine here. I'll try on an another box tomorrow

Revision history for this message
Eugenia Loli-Queru (eloli) wrote :

application/x-shellscript
Mime type seems correct, permissions are correct, and still, they open with
gedit (and in the case of nautilus scripts, they don't show at all).

Revision history for this message
Sebastien Bacher (seb128) wrote :

Ok, this bug is due to an outdated shared-mime-info

Update shared-mime-info from 0.14 to 0.15 fixes the issue. For that we need to
update libxml2 2.6.11 (we have 2.6.10).

Jeff, Matt, is that ok to update libxml2 ? 2.6.11 is in debian for 2 months and
no problem reported ...

Revision history for this message
Jeff Waugh (jdub) wrote :

Seb, yes, libxml2 is part of GNOME! :-)

Revision history for this message
Santiago Erquicia (santiago-erquicia-gmail) wrote :

I can confirm that the new mime stuff solved this problem

Revision history for this message
Matt Zimmerman (mdz) wrote :

New libxml2 is fine

Revision history for this message
Sebastien Bacher (seb128) wrote :

 shared-mime-info (0.15-0ubuntu1) warty; urgency=low
 .
   * Fix the problem with scripts in nautilus (Warty: #1285).

Revision history for this message
Eugenia Loli-Queru (eloli) wrote :

Yes, it has fixed my scripts too. Thanks.

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.