monteverdi $input_filename crash with relative path
Mantis Issue 1300, reported by mgrizonnet, assigned to gpasero, created: 2016-10-13
monteverdi /test/im_dir/image.tif works but if you do:
cd /test and then monteverdi im_dir/image.tif the application crashes (see backtrace in aditional information section.
Note that it does not solve the issue to add './': monteverdi ./im_dir/image.tif crashes also
Backtrace:
terminate called after throwing an instance of 'otb::ImageFileReaderException'
what(): /home/grizonnetm/projets/otb/src/OTB-stable/Modules/IO/ImageIO/include/otbImageFileReader.txx:291:
Could not create IO object for file 000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF
Tried to create one of the following:
RADImageIO
BSQImageIO
LUMImageIO
JPEG2000ImageIO
TileMapImageIO
GDALImageIO
MWImageIO
ONERAImageIO
MSTARImageIO
You probably failed to set a file suffix, or
set the suffix to an unsupported type.
Thread 1 "monteverdi" received signal SIGABRT, Aborted.
0x00007ffff5b3c418 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54 ../sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type.
(gdb) backtrace
#0 0x00007ffff5b3c418 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007ffff5b3e01a in __GI_abort () at abort.c:89
#2 0x00007ffff617584d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff61736b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff6173701 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff6173969 in __cxa_rethrow () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff6607810 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7 0x00007ffff78e8da3 in mvd::StackedLayerModel::ContentChanged (this=<optimized out>)
at /home/grizonnetm/projets/otb/bin/release/OTB-stable/Modules/Visualization/MonteverdiCore/src/__/include/moc_mvdStackedLayerModel.cxx:199
#8 0x00007ffff78d0edc in mvd::StackedLayerModel::Insert[abi:cxx11](mvd::AbstractLayerModel*, unsigned long) (this=this@entry=0x11fc5f0, model=model@entry=0x7fffa802b9f0, index=index@entry=0)
at /home/grizonnetm/projets/otb/src/OTB-stable/Modules/Visualization/MonteverdiCore/src/mvdStackedLayerModel.cxx:406
#9 0x000000000040e276 in mvd::MainWindow::ImportImage (this=this@entry=0x7fffffffdb70, filename=..., index=index@entry=0)
at /home/grizonnetm/projets/otb/src/OTB-stable/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx:1195
#10 0x000000000040f23f in mvd::MainWindow::ImportImages (this=this@entry=0x7fffffffdb70, filenames=...)
at /home/grizonnetm/projets/otb/src/OTB-stable/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx:1254
#11 0x000000000040b1ff in main (argc=2, argv=<optimized out>) at /home/grizonnetm/projets/otb/src/OTB-stable/Modules/Visualization/Monteverdi/src/main.cxx:197
2016-10-18 11:16 - grizonnetm: fixed with expanding to full path in Ossim (related to S1 bug 1286): 30412b2b
2016-10-24 16:01 - grizonnetm: I can reproduce the issue on the release branch. Can someone try to reproduce it?
2016-10-27 10:36 - gpasero: Reproduced on my build (27/10/16)
2016-10-27 12:33 - gpasero: This time, the error seems to happen in GDALIdentifyDriver() calls. The first calls work fine, but then no driver is returned.
2016-10-27 17:56 - gpasero: Fixed here : 468b0e57
We prefer to use a static variable to store recent directory used as the call to QDir::setCurrent() will change the system current working dir. See #1180 (closed) for details.
2017-08-30 17:13 - salbert: otb::GetOpen/SaveFileName(s) won't work if submitting (relative) filepath (i.e. flename without directory or with relative directory; and relative directory).
I use those functions in otbWrapperQtWidgetListEditWidget.cxx
Moreover, the QDir::setCurrent() use was done to fix an old but to set current directory between Monteverdi and the OTB-Applications (usecase: when launched from Monteverdi). At that time (before Monteverdi was included in OTB), this was the only way to do. Therefore, some Dir::setCurrent() ::getCurrent() are still not replaced in the Monteverdi source code which should be updated.