Bug 389960 - Fits Open fails for files with parenthesis in path or name
Summary: Fits Open fails for files with parenthesis in path or name
Status: RESOLVED FIXED
Alias: None
Product: kstars
Classification: Applications
Component: general (show other bugs)
Version: git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Jasem Mutlaq
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-06 17:26 UTC by schwim
Modified: 2018-02-09 10:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 2.9.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description schwim 2018-02-06 17:26:21 UTC
Repeatable on Mint Xenial and OSX as of 2.9.2 as the latest git builds.

 - In the kstars main window or the FITS viewer, go to File->Open FITS
 - Navigate to a fits file that either has a parenthesis in the path or in the file name itself.
 - Attempt to open the file. This results in an error and the file does not open.

Error message is:

   Could not open file <path to file>. Error could not open the named file

I noticed this due to the fact that Dropbox forces a parenthesis in the directory name. 

Workaround for directories: create a link to the directory, e.g.: 

   ln -s <path to directory with paren> <link name no paren>
Comment 1 Jasem Mutlaq 2018-02-08 06:36:24 UTC
It seems you can't have filenames with brackets or parentheses since they have special meanings in the FITS extended file syntax.

More information here: https://heasarc.gsfc.nasa.gov/docs/software/fitsio/filters.html

Not sure if we can have a workaround for this.
Comment 2 schwim 2018-02-08 17:32:31 UTC
(In reply to Jasem Mutlaq from comment #1)
> It seems you can't have filenames with brackets or parentheses since they
> have special meanings in the FITS extended file syntax.
> 
> More information here:
> https://heasarc.gsfc.nasa.gov/docs/software/fitsio/filters.html
> 
> Not sure if we can have a workaround for this.

Confirmed that files with brackets cause the same problem.  The workaround above does not work appear to work on OSX due to how the OSX software handles links.

I see the CFITSIO docs specify fits_open_diskfile as a possible solution where such characters are used. Not sure if this would help:

https://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/node35.html
Comment 3 Jasem Mutlaq 2018-02-09 09:16:02 UTC
KStars uses fits_open_image not fits_open_file.. so if fits_open_diskfile is used, we need to move manually to image HDU which can be done. Will see if this can be implemented later on.
Comment 4 Jasem Mutlaq 2018-02-09 10:02:40 UTC
Git commit f79a51cb1883eb2e222f7e0afe13fc4acc5ad56a by Jasem Mutlaq.
Committed on 09/02/2018 at 10:01.
Pushed by mutlaqja into branch 'master'.

Use fits_open_diskfile to enable reading filename that may contain paranthesis and brackets.
FIXED-IN:2.9.3

M  +22   -1    kstars/ekos/align/align.cpp
M  +33   -1    kstars/fitsviewer/fitsdata.cpp
M  +16   -0    kstars/indi/indiccd.cpp

https://commits.kde.org/kstars/f79a51cb1883eb2e222f7e0afe13fc4acc5ad56a