BIC-MNI / minc-toolkit

Metaproject uniting all the available minc tools
GNU General Public License v3.0
37 stars 15 forks source link

minc-toolkit perl function update_history (or minc_modify_header?) fails with long arguments #21

Open gdevenyi opened 9 years ago

gdevenyi commented 9 years ago

While working with autocrop, the cropping would succeed, but then throw the following error:

spawn: exec of minc_modify_header failed: Argument list too long
autocrop: crashed while running minc_modify_header (termination status=65280)

The command I was using to start autocrop

autocrop -clobber -verbose -debug -bbox /home/cic/devgab/projects/cutneck//chamal_hr_003_20141105_150333_2_mri.cutneck.tmp -isoexpand 5 /data/chamal/projects/raihaan/2014-11-05-Rob/chamal_hr_003_20141105_150333/chamal_hr_003_20141105_150333_2_mri.mnc /home/cic/devgab/projects/cutneck//chamal_hr_003_20141105_150333_2_mri.cutneck.mnc

Commenting out the instances of update_history in autocrop solved the crash.

andrewjanke commented 9 years ago

This would seem a tad strange, if you run with a -verbose flag is there an extremely long argument list anywhere?

On most Linux based systems ARG_MAX is massive these days (for me):

$ getconf ARG_MAX 2097152

Which OS are you running on? or is this a perl problem with the internals of spawn?

a

gdevenyi commented 9 years ago

Well, it was run with verbose, and debug, so that's all the output I got. I can try and add a print somewhere and see what I get.

This is on Debian 6.0, Linux x86_64

I'll check ARG_MAX to be sure tomorrow.

gdevenyi commented 5 years ago

A very late followup, ARG_MAX is the same for me.

The root cause of this seems to be the case where dcm2mnc is called with an entire directory tree of DICOMs at once (like an entire study) and then the -fname/-dname features are used to split up the MINC files. This produces a huge history entry from the conversion, which is much longer than ARG_MAX.