Opened 10 years ago

Closed 10 years ago

#2572 closed defect (fixed)

grass command welcomes batch job and requires user input

Reported by: wenzeslaus Owned by: grass-dev@…
Priority: minor Milestone: 6.4.5
Component: Startup Version: 6.4.4
Keywords: GRASS_BATCH_JOB, rc file, init, startup Cc:
CPU: Unspecified Platform: Linux

Description

When calling GRASS GIS to do a batch job without having rc file created, one gets:

WELCOME TO GRASS              Version 6.4.4         2014
...
      - Current catalog of available computer maps
...
Hit RETURN to continue

This warm welcome is intended for user but when a GRASS_BATCH_JOB is set, this should not be executed because there is usually nobody to hit RETURN since the process is executed from some program.

Test setup:

cat > test_script.sh <<EOF
echo "Hello from GRASS GIS" > test_file.txt
date >> test_file.txt
EOF
export GRASS_BATCH_JOB=$PWD/test_script.sh

Test:

rm ~/.grassrc6
grass64 ~/grassdata/nc_spm_08_grass7_tests/user1

Here is a patch which works for me for version 6.4:

  • lib/init/init.sh

     
    421421fi
    422422
    423423# First time user - GISRC is defined in the GRASS script
    424 if [ ! -f "$GISRC" ] ; then
     424if [ ! -f "$GISRC" -a ! -n "$GRASS_BATCH_JOB" ] ; then
    425425
    426426    if [ ! -f "$GISBASE/locale/$LCL/etc/grass_intro" ] ; then
    427427        cat "$ETC/grass_intro"

I'm not sure if it is correctly implemented because it causes that the rc file (~/.grassrc6) is not created (using the $HOME and <UNKNOWN>). It does not seem useful anyway but I guess that there is some reason for it.

Basically the same patch can be applied to version 7. Check GRASS_BATCH_JOB (batch_job) before calling grass_intro(). I'm just don't have the full understanding of the code, for example I'm not sure how rc file is supposed to be handled with GRASS_BATCH_JOB (source:grass/trunk/lib/init/grass.py?rev=64377#L1339).

A workaround for version 6.4 is to create a .grassrc6 file in directory specified by $HOME with some reasonable content (e.g. a copy of existing .grassrc6 from different user).

Related:

Change History (2)

comment:1 by wenzeslaus, 10 years ago

Keywords: startup added

Fixed in r64438 for 6.4 and in r64408 for trunk.

r64438 uses does not show the message and does not require the input when GRASS_BATCH_JOB is defined but still creates the rc file. r64408 removes the message and the request of input altogether and leaves just the creation of the rc file.

r64438 can be tested and was tested using the steps described earlier (and by standard start of GRASS after rm ~/.grassrc6). Note that to test r64408 for version 7, you have to delete (or rename) file ~/.grass7/rc.

r64408 should be safe enough to be backported any time to release branch but the right time is after RC2 considering the freeze.

in reply to:  1 comment:2 by wenzeslaus, 10 years ago

Resolution: fixed
Status: newclosed

Replying to wenzeslaus:

r64408 should be safe enough to be backported any time to release branch but the right time is after RC2 considering the freeze.

Backported to 7.0 in r64569 after RC2 and after test on MS Windows (with removed GRASS7 in the AppData Roaming directory). I got to startup window so easily that I had to start beta3 too see what I'm actually testing.

Note: See TracTickets for help on using tickets.