Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit with status of 1, though executed manually works #30

Open
nickurbanik opened this issue Oct 22, 2012 · 13 comments
Open

Exit with status of 1, though executed manually works #30

nickurbanik opened this issue Oct 22, 2012 · 13 comments

Comments

@nickurbanik
Copy link

Fedora 17, Firefox 16.01, It's All Text 1.6.4, x86_64, selinux enforcing
"I ran this command: /usr/bin/emacsclient /home/nicku/.mozilla/firefox/...

...and it exited with a status of 1."

I can run the exact command in a terminal, and emacs shows the exact textarea content,
with no error. It's All Text has always worked for me until recently.

I really need It's All Text ---just had Firefox crash and lost an hour's editing :-(

@docwhat
Copy link
Owner

docwhat commented Oct 22, 2012

Hello!

I suspect SELINUX may be preventing Firefox from running your editor.

I'm not familiar with SELINUX, but you might see something useful in issue #18 with a similar issue with AppArmor.

Ciao!

@sanel
Copy link

sanel commented Nov 4, 2012

The same issue here on the same setup, except I have SELINUX fully disabled. The only way to run emacsclient is to use 'emacsclient -c' option (coded in separate script which is called by itsalltext). But... this works only once: when I hit 'edit' for the first time, emacs opens the frame (or window) and when I close it, hitting 'edit' again will not open the window again.

Any ideas?

@docwhat
Copy link
Owner

docwhat commented Nov 6, 2012

@sanel -- I'm unfamiliar with the -c flag for emacsclient. My version doesn't have it. What does it do? I suspect your issue is unrelated. Or if it is related, it'll require a different set of debugging to figure it out. Would you file a new issue and take a look at your system logs, especially auth or security logs? AppArmor can cause the same problems as SELinux...

@sanel
Copy link

sanel commented Nov 6, 2012

Hi,

'-c' flag will open new emacs frame, without using existing frame. I'm using emacs/emacsclient only in terminal, so this is the only way to open it within current session.

Yes, the issue is related: when emacsclient is configured as default editor, hitting 'edit' on web page text box will result the same error report as @nickurbanik reported. However, when I manually enter that command in terminal (the full command and file path is shown in message box), emacs will open the file without problems.

I'm using emacs 24.1.1, selinux is disabled (Fedora does not have apparmor).

@sanel
Copy link

sanel commented Nov 6, 2012

Here is my second try: I configured emacsclient as default editor and started firefox from terminal. Here is firefox output:

/usr/bin/emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".
/usr/bin/emacsclient: No socket or alternate editor.  Please use:

        --socket-name
        --server-file      (or environment variable EMACS_SERVER_FILE)
        --alternate-editor (or environment variable ALTERNATE_EDITOR)

However, this is quite odd, as plain emacsclient started from console will find daemon socket. Also, I'll note how I have quite basic ~/.emacs file without any kind of fiddling with socket paths.

@sanel
Copy link

sanel commented Nov 6, 2012

Update no.3 :D With the same setup (emacsclient in terminal) and after itsalltext report the error, opening given path in terminal and editing seems to correctly work: it will update the content of text area after content was saved. Looks like the only problem is in that error dialog :S

@docwhat
Copy link
Owner

docwhat commented Nov 8, 2012

That's true. The "refreshing" of the textarea is independent of actually being able to launch the editor.

@wallrj
Copy link

wallrj commented Nov 25, 2012

I had a similar problem on Fedora 17 but in my case it turned out to
be that the firefox start script overrides the TMPDIR environment
variable. eg

[richard@zorin ~]$ egrep -n -C 2 TMPDIR /usr/bin/firefox

147-## Use /var/tmp instead of /tmp because of 1GB /tmp limit in  Fedora 18 and later
148-##
149:TMPDIR="/var/tmp"
150:export TMPDIR
151-
152-# OK, here's where all the real work gets done

So when emacsclient starts as a subprocess of firefox, it looks for
the emacs --daemon socket in /var/tmp/emacsXXXX/server instead of /tmp

So just set the environment variable in your launch script eg

$ cat ~/.local/bin/edit

#!/bin/sh
export TMPDIR=/tmp
emacsclient \
    --alternate-editor= \
    --create-frame \
    "$@"

@nickurbanik
Copy link
Author

Thank you very much wallrj; very good work! Editing this with Emacs.
I am using Fedora 18 now, with its /tmp as tmpfs.
Firefox should use /var/tmp for most things, but itsalltext should
look in /tmp for the emacs server socket.
I haven't examined the code in itsalltext, but there should hopefully
be a way of determining where to look for the socket that works in all
cases.

@docwhat
Copy link
Owner

docwhat commented Nov 26, 2012

You can create your own emacsclient shell script, like @wallrj did. That will fix it. Changing IAT to work around different setups seems like a sisyphean task; depending on the OS and user setup, TMPDIR may or may not need to be set to /var/tmp.

I think its best if IAT doesn't try to guess and lets the user override it with a shell or cmd script.

@sanel
Copy link

sanel commented Nov 26, 2012

I will also confirm how wallrj's advice works for me too. Thanks!

I think its best if IAT doesn't try to guess and lets the user override it with a shell or cmd script.

How about documenting this case on wiki or documentation? ;)

@brannerchinese
Copy link

I have the same problem on Mac OS 10.8.2, Firefox 17.0.1. I've set

/usr/bin/vim

as the editor in IAT's preferences. Clicking the edit button on a Firefox text field raises this error dialog:

I ran this command: /usr/bin/vim /Users/dpb11/Library/Application Support/Firefox/Profiles/<...>.txt

...and it exited with a status of 1.

However, almost exactly the same command and argument on the command line runs vim correctly, and when the file is saved, the Firefox text field populates correctly.

The one difference is that on the command line I have placed the argument within quotes, since part of the path is an OS X system-directory with a space in it (Application Support). That directory's name cannot be changed.

Question: is IAT quoting the file-path it inserts after the editor path?

@docwhat
Copy link
Owner

docwhat commented Dec 23, 2012

@brannerchinese You need to use MacVim or wrap vim in a shell script that opens a new terminal window. The editor command is run without a terminal attached, so plain vim won't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants