moses-smt / mgiza

A word alignment tool based on famous GIZA++, extended to support multi-threading, resume training and incremental training.
161 stars 60 forks source link

mgiza goes segmentation fault when USER environment variable is not set #4

Closed aijanai closed 8 years ago

aijanai commented 9 years ago

The issue is in _Get_FileSpec() function, in _mgizapp/src/filespec.h: calling _user = getenv("USER");_ when USER variable is not set causes a segmentation fault.

I worked it around by calling export USER='www-data' (I was invoking the training chain from within a PHP script), but is this really necessary just to write a log file?

hieuhoang commented 9 years ago

You're right, it should be set to an arbitrary string if the username isn't found. If you make the code change, please send the code to me & i'll commit it. Otherwise, i'll do it in the next few days

hieuhoang commented 8 years ago

fixed by Matjaz Rihtar https://github.com/mrihtar/mgiza/commit/2b2bfbcb9dfe1f509f13597f186f01367c965b84