mainGNU Astronomy Utilities - Support: sr #110802, Programs delete input when it has...

 
 

sr #110802: Programs delete input when it has same name as output

Submitter:  Faezeh Bidjarchian <fbidjarchian>
Submitted:  Thu 15 Dec 2022 04:07:46 PM UTC
   
 
Category:  All Gnuastro Priority:  5 - Normal
Severity:  3 - Normal Item Group:  * Input/Output
Status:  Done Privacy:  Public
Assigned to:  makhlaghi Open/Closed:  Closed
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 17 Dec 2022 06:05:40 PM UTC, comment #2: 

This support issue was fixed as part of bug #63543 (in Commit 1ef6e92a5ed).

Mohammad Akhlaghi <makhlaghi>
Group administrator
Thu 15 Dec 2022 08:03:44 PM UTC, comment #1: 

Thanks for the nice bug report Faezeh!

To generalize the bug, we can say that anytime the name of a program's input filename is the same as the output filename, the program will delete the output (which is the same as the input!) and therefore will complain that the input doesn't exist!

I have already started the work on fixing it in this branch of my development project. Only some tests with the installed scripts are failing. As soon as I find some time, I'll fix those also and then merge this fix into the 'master' branch and close this bug!

Thanks a lot for the nice catch ;-).

Mohammad Akhlaghi <makhlaghi>
Group administrator
Thu 15 Dec 2022 04:07:46 PM UTC, original submission:  

If we have an image (image.fits) that contains NaN pixels, then after doing some calculations on it (in my case using astarithmetic for filtering) maybe we will lose the nan pixels. So if we need to replace all NaN pixels in our output (image_arith.fits) to indicate that those pixels should not be used (or for other reasons), we use this command:

astarithmetic image_arith.fits image.fits -h1 isblank nan where

In this command, the order of the FITS files is important: the first image must be our output (after doing some calculations) and the second image is our raw image that includes NaN pixels.

If these two FITS files are wrongly swapped in the command (the following command), we expect no output to be produced. But not only is there no output, but one of the input (image_arith) also disappears:

astarithmetic image.fits image_arith.fits -h1 isblank nan where

Maybe the name of the output is the same as the name of our input (image_arith), and because it should not produce the output with this name, it deletes the input with the identical name! As we know if we do not determine an output name in our command, the output is called image_arith (the name of input with "_arith") as a default.

Faezeh Bidjarchian <fbidjarchian>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by makhlaghi (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-12-17 makhlaghi StatusIn Progress Done
        Open/ClosedOpen Closed
    2022-12-15 makhlaghi CategoryNone All Gnuastro
        StatusNone In Progress
        Assigned toNone makhlaghi
        SummaryWhen using the wrong command, the entry vanishes! Programs delete input when it has same name as output
    2022-12-15 fbidjarchian Carbon-CopyRemoved 338034 -

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code