Menu

#25 bad file descriptor

v1.0 (example)
open
2
2005-01-24
2004-08-13
geoff
No

I'm getting the following error - any ideas ?

Could not execute 'c:/Progra~1/Aspell/bin/aspell -a
--lang=en_US --encoding-utf-8 < c:\WINNTTEMP<bunch of
chars> |
bad file descriptor

Does anyone know what causes this - I've tried changing
the command and temp file used ..

Discussion

  • James Shimada

    James Shimada - 2004-08-16
    • assigned_to: nobody --> jshimada
     
  • James Shimada

    James Shimada - 2004-08-16

    Logged In: YES
    user_id=736426

    Can you tell me what the '$aspell_prog' and '$tempfiledir'
    variables are set to in spellchecker.php? (Assuming you're
    using the PHP script and not the Perl script).

    For Windows, I'd recommend setting the '$aspell_prog'
    variable like this:

    $aspell_prog = '"C:\Program&nbsp;Files\Aspell\bin\aspell.exe"';

    This is the default location of a windows aspell installation
    (keep the double quotes within the single quotes of the
    directory path).

    Also, the following doc goes into more detail on installation on
    Windows, it might help or give you some more ideas:

    http://sourceforge.net/docman/display_doc.php?
    docid=19473&group_id=86602

     
  • geoff

    geoff - 2004-08-16

    Logged In: YES
    user_id=1103573

    I'm using the perl script. not PHP.
    ASpell will run from the command line (using the same
    command, (different file to check the spelling of course).

     
  • geoff

    geoff - 2004-08-16

    Logged In: YES
    user_id=1103573

    Top of perl file :

    use CGI qw/ :standard /;
    use File::Temp qw/ tempfile tempdir /;

    my $spellercss = '..//spellerStyle.css';
    my $wordWindowSrc = '../wordWindow.js';
    my @textinputs = param( 'textinputs[]' ); # array

    #my $aspell_cmd = 'c:/Progra~1/Aspell/bin/aspell';
    my $aspell_cmd = 'aspell';
    -====================================

     
  • James Shimada

    James Shimada - 2004-08-25

    Logged In: YES
    user_id=736426

    Does it still fail if you use the following:

    my $aspell_cmd = '"C:\Program Files\Aspell\bin\aspell.exe"';

    (assuming this is the location of the executable)?

    I've never seen this "bad file descriptor" error but maybe
    it's complaining about the '2>&1' part of the following:

    # exec aspell command
    my $cmd = "$aspell_cmd $aspell_opts < $tmpfilename 2>&1";

    Try removing '2>&1' to see if it helps. Unfortunately,
    removing it will prevent you from seeing any standard error
    output.

    If that doesn't help, my only suggestion would be to keep
    debugging by running the command yourself to try and
    simulate the call to aspell.

    Let me know if you're able to get this resolved.

     
  • James Shimada

    James Shimada - 2004-09-23
    • status: open --> closed
     
  • James Shimada

    James Shimada - 2004-09-23

    Logged In: YES
    user_id=736426

    Closing since I haven't heard back in a while. Assuming it's
    resolved.

     
  • geoff

    geoff - 2005-01-10

    Logged In: YES
    user_id=1103573

    I'm re-opening this as I'm still seeing this problem.. - any
    suggestions about how to debug this ?

     
  • geoff

    geoff - 2005-01-10
    • status: closed --> open
     
  • geoff

    geoff - 2005-01-10

    Logged In: YES
    user_id=1103573

    Here's how to troubleshoot (assuming you're using the PHP version):

    1. Modify spellchecker.php. Comment out the line "unlink(
    $tempfile );" like so:

    # close temp file, delete file
    # unlink( $tempfile );

    2. Run the spell checker once again and make note of the
    error message. It will show you the command that failed.

    3. Log in to the server and open a command prompt. Change
    to the directory spellchecker.php is in and execute the
    command exactly as you saw in #2. For instance:

    $ aspell -a --
    lang=en_US < /var/tmp/aspell_data_jATMUZ

    Or on Windows:

    > "C:\Program Files\Aspell\bin\aspell.exe" -a --lang=en_US <
    C:\WINNT\TEMP\asp45.tmp

    NOTE: On Windows, make sure the double quotes surround
    C:\Program Files\Aspell\bin\aspell.exe both in the PHP code and
    when you're running it from the command prompt. The double
    quotes escape the space between Program and Files.

    4. Running the command manually from the command prompt
    should show you the error output that was not trapped by the PHP
    script. Then you can troubleshoot further from there.

     
  • geoff

    geoff - 2005-01-12
    • priority: 5 --> 6
     
  • geoff

    geoff - 2005-01-12

    Logged In: YES
    user_id=1103573

    Here's how to troubleshoot (assuming you're using the PHP version):

    1. Modify spellchecker.php. Comment out the line "unlink(
    $tempfile );" like so:

    # close temp file, delete file
    # unlink( $tempfile );

    2. Run the spell checker once again and make note of the
    error message. It will show you the command that failed.

    3. Log in to the server and open a command prompt. Change
    to the directory spellchecker.php is in and execute the
    command exactly as you saw in #2. For instance:

    $ aspell -a --
    lang=en_US < /var/tmp/aspell_data_jATMUZ

    Or on Windows:

    > "C:\Program Files\Aspell\bin\aspell.exe" -a --lang=en_US <
    C:\WINNT\TEMP\asp45.tmp

    NOTE: On Windows, make sure the double quotes surround
    C:\Program Files\Aspell\bin\aspell.exe both in the PHP code and
    when you're running it from the command prompt. The double
    quotes escape the space between Program and Files.

    4. Running the command manually from the command prompt
    should show you the error output that was not trapped by the PHP
    script. Then you can troubleshoot further from there.

     
  • geoff

    geoff - 2005-01-12

    Logged In: YES
    user_id=1103573

    I've dug into this further.. the command does run (from the
    command prompt) on the machine, however not from the web
    broswer.

    the command that is failing is :

    my $cmd = "$aspell_cmd $aspell_opts < $tmpfilename 2>&1";

    open ASPELL, "$cmd |" or handleError( "Could not execute
    `$cmd`\\n$!" ) and return;
    ==========================================

    if I change the cmd to :
    my $cmd = "dir";

    I get the same error, so I'm suspecting that this a perl
    error, but I'm not sure where to look..
    the webserver is running IIS with active perl.

    Geoff.

     
  • James Shimada

    James Shimada - 2005-01-23

    Logged In: YES
    user_id=736426

    Hi,

    Any luck tracking this down? I googled around for the "bad
    file descriptor" error but I wasn't able to get that far.
    You're right, though, if you're getting that error if you
    simply try and execute "dir" then it must be some problem
    with how perl is executing the command. I guess you could
    try some other mechanisms like system() or `command` to see
    if that gets you anywhere.

     
  • geoff

    geoff - 2005-01-24

    Logged In: YES
    user_id=1103573

    No I haven't figured it out.. I will dig into the active
    perl docs/support to see if I can figure it out (I'll post a
    solution if I find one)

     
  • geoff

    geoff - 2005-01-24
    • priority: 6 --> 2
     
  • James Stormes

    James Stormes - 2005-01-26

    Logged In: YES
    user_id=993243

    I am getting the same error on Linux with FC

    System error: Aspell program execution failed ...

    I am still researching myself.

     
  • tophat james

    tophat james - 2005-01-29

    Logged In: YES
    user_id=1174591

    I had the same problem. There's a php file under the
    server classes that sets a variable called $ttemp to ./ and
    that causes the problem when it tries to first create the
    temp file in the curent directory and then, when it can't,
    it tries to create the temp file in /tmp for aspell, and
    under FC3, at least, it can't create the file in /tmp. It
    appears to be unable to create a file that high in the
    directory tree. So I created a tmp directory under the
    Document Root for my web server (/var/www/html/tmp) with 777
    privs, and edited the temp varialbe in the script to create
    the file there, and it did so without any problems. I
    talked with the developer -- i'm the sysadmin, and he said
    he could override the temp varialbe to have it create the
    file in a tmp directory under the Document root.

     
  • Nobody/Anonymous

    Logged In: NO

    I am also having trouble on a Windows installation.

    I can run aspell from the command line fine.
    Speller is creating a temp file and when I run aspell on
    this file it gives suggested words for the mispelled words.

    I've tried both php and perl scripts and both give errors.

    Here is what the perl script is returning:

    var suggs = new Array(); var words = new Array(); var
    textinputs = new Array(); var error; textinputs[0] =
    decodeURIComponent('%20%09Today%20we%20read%20four%20books.%20He%20read%20very%20well%20and%20I%20felt%20he%20is%20ready%20for%20more%20challenging%20books.%20We%20also%20worked%20on%20mathematics%20flash%20cards%2C%20nore%20specifically%3A%20subtraction.')

     
  • James Stormes

    James Stormes - 2005-03-18

    Logged In: YES
    user_id=993243

    Some common issues we found trying to get speller pages to
    work with different Linux distributions:

    1) Try setting selenux setting to permissive, in FC3 edit
    the file /etc/sysconfig/selinux and change the line
    SELINUX=enforcing to SELINUX=permissive. I suggest
    researching selinux and finding the correct way to fix this.

    2) Edit the file the file in your SpellerPages directory
    server-scripts called spellchecker.php and set the
    $tempfiledir to a path under the web root directory. Also,
    create that path and give the user-id that Apache runs user
    full read write permissions. I assume that some security
    foo is keeping it from accessing any path outside the
    webroot path. You may want to chmod this directory for
    better performance ie the +t option.

    Both of these settings were required to get SpellerPages to
    work under FC3. We don't use Windows but maybe this will help.

    James Stormes
    Lead Developer Agent Email

     
  • James Shimada

    James Shimada - 2005-04-02

    Logged In: YES
    user_id=736426

    James, thanks for the input for how you resolved the
    problems in FC3 Linux. Geoff, are you still having the
    issue? Did it help to set the $tempfiledir variable in
    spellchecker.php to a directory in the website root that has
    proper permissions?

     
  • Nobody/Anonymous

    Logged In: NO

    I haven't tried it yet - I will post an update when I do.

    Geoff.

     
  • Nobody/Anonymous

    Logged In: NO

    I have worked with this some more - the script is able to
    create the file (so permissions aren't a problem), however I
    still get the file descriptor error.

    Geoff.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.