[MINC-users] xfmconcat -clobber bug

Andrew Janke a.janke at gmail.com
Fri Jul 6 02:43:47 EDT 2012


Hi Alex,

This really isn't a bug in xfmconcat but rather a bug in volume_io
somewhere around here:

   https://github.com/BIC-MNI/minc/blob/master/volume_io/MNI_formats/gen_xf_io.c#L187

The question is though given that it's going to be a pain to get the
value of the clobber flag into this function what is the desired
behaviour. My thoughts would be that if the code has got to writing a
transform it should simply write the transform irrespective of whether
the target is a link or a file.

So, do we introduce a test to see if the output grid file exists
(already) and if it does, remove it? This should get around all
combinations of this that I can think of.


a

On 5 July 2012 02:19, Alex Zijdenbos <zijdenbos at gmail.com> wrote:
> Hi all,
>
> I just stumbled across a (actually two) problems with xfmconcat:
>
> 1) When run with -clobber, if the grid*.mnc files referenced in the
> xfm are symlinks, it will try to clobber the files that are referenced
> by the symlink, not the symlinks themselves, and
>
> 2) When it cannot overwrite the referent grid files (e.g., because of
> write protection or ownership), it will throw a warning, but still
> returns a 0 exit status.
>
> So, when concat_grid_0.xfm is a symlink to a non-writeable file,
> xfmconcat nominally succeeds:
>
> $ ls -al concat_grid_0.mnc
> 0 lrwxrwxrwx 1 alex alex 13 2012-07-04 12:13 concat_grid_0.mnc -> /usr/bin/last*
> $ xfmconcat -clobber a.xfm b.xfm concat.xfm
> (from micreate): Unable to create file 'concat_grid_0.mnc'
> Error: opening MINC file "concat_grid_0.mnc".
> $ echo $?
> 0
>
> Obviously, the resulting xfm (+grids) will not be what the user expected.
>
> I think that at minimum, xfmconcat should fail when it can't write a
> file; and I would also say that when clobbering, it should clobber a
> symlink, not the referent file (but that latter point is up for debate
> perhaps, which is actually why I raised it here).
>
> -- A
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users


More information about the MINC-users mailing list