[GRASS GIS] #595: WinGRASS g.version -c fails

7 messages Options
Embed this post
Permalink
GRASS GIS

[GRASS GIS] #595: WinGRASS g.version -c fails

Reply Threaded More More options
Print post
Permalink
#595: WinGRASS g.version -c fails
--------------------------+-------------------------------------------------
 Reporter:  hamish        |       Owner:  [hidden email]
     Type:  defect        |      Status:  new                      
 Priority:  critical      |   Milestone:  6.4.0                    
Component:  License       |     Version:  6.4.0 RCs                
 Keywords:  wingrass gpl  |    Platform:  MSWindows XP            
      Cpu:  x86-32        |  
--------------------------+-------------------------------------------------
 Hi,

 if you try 'g.version -c' to print the COPYING file it doesn't because the
 $GISBASE/etc/VERSION file is empty.

 Apparently the g.version/Makefile sed magic is failing:

 {{{
 COPYING:
         cat ./../../COPYING | sed -f sed.script | tr -d '\012' >
 $(GRASS_VERSION_FILE)
 }}}

 sed.script contains:
 {{{
 s/.*$/&\\n/g
 }}}


 Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/595>
GRASS GIS <http://grass.osgeo.org>

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

Re: [GRASS GIS] #595: WinGRASS g.version -c fails

Reply Threaded More More options
Print post
Permalink
#595: WinGRASS g.version -c fails
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      Type:  defect        |      Status:  new                      
  Priority:  blocker       |   Milestone:  6.4.0                    
 Component:  License       |     Version:  6.4.0 RCs                
Resolution:                |    Keywords:  wingrass gpl            
  Platform:  MSWindows XP  |         Cpu:  x86-32                  
---------------------------+------------------------------------------------
Changes (by martinl):

  * priority:  critical => blocker

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/595#comment:1>
GRASS GIS <http://grass.osgeo.org>

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

Re: [GRASS GIS] #595: WinGRASS g.version -c fails

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#595: WinGRASS g.version -c fails
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      Type:  defect        |      Status:  new                      
  Priority:  blocker       |   Milestone:  6.4.0                    
 Component:  License       |     Version:  6.4.0 RCs                
Resolution:                |    Keywords:  wingrass gpl            
  Platform:  MSWindows XP  |         Cpu:  x86-32                  
---------------------------+------------------------------------------------
Comment (by hellik):

 in the grass64 delivered by the osgeo4w-stack "g.version -c" works

 in the self compiled grass65-devel (rev39115) the$GISBASE/etc/VERSION is
 empty

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/595#comment:2>
GRASS GIS <http://grass.osgeo.org>

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

Re: [GRASS GIS] #595: WinGRASS g.version -c fails

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#595: WinGRASS g.version -c fails
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      Type:  defect        |      Status:  new                      
  Priority:  blocker       |   Milestone:  6.4.0                    
 Component:  License       |     Version:  6.4.0 RCs                
Resolution:                |    Keywords:  wingrass gpl            
  Platform:  MSWindows XP  |         Cpu:  x86-32                  
---------------------------+------------------------------------------------
Comment (by cnielsen):

 {{{
 cat ./../../COPYING | sed -f sed.script | tr -d '\012' > /src/dev_6/dist.
 i686-pc-mingw32/etc/VERSION
 sed: file sed.script line 1: Unknown option to 's'
 }}}

 I might be missing something here but when I took the contents of
 sed.script and stuck them into the cmd itself with -e it works fine:
 {{{
 cat ./../../COPYING | sed -e 's/.*$/&\\n/g' | tr -d '\012' >
 /src/dev_6/dist
 .i686-pc-mingw32/etc/VERSION
 }}}
 Is there a benefit to having it in a *.script instead?

 -Colin

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/595#comment:3>
GRASS GIS <http://grass.osgeo.org>

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

Re: [GRASS GIS] #595: WinGRASS g.version -c fails

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#595: WinGRASS g.version -c fails
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      Type:  defect        |      Status:  new                      
  Priority:  blocker       |   Milestone:  6.4.0                    
 Component:  License       |     Version:  6.4.0 RCs                
Resolution:                |    Keywords:  wingrass gpl            
  Platform:  MSWindows XP  |         Cpu:  x86-32                  
---------------------------+------------------------------------------------
Comment (by cnielsen):

 Spoke too soon, it fails if that change is made in the Makefile but not if
 run in the shell. Note the difference:
 When Makefile runs:
 {{{
 cat ./../../COPYING | sed -e 's/.*&\\n/g' | tr -d '\012' >
 /src/dev_6/dist.i686-pc-mingw32/etc/VERSION
 sed: -e expression #2, char 10: Unterminated `s' command
 }}}
 Although in Makefile I wrote:
 {{{
 cat ./../../COPYING | sed -e 's/.*$/&\\n/g' | tr -d '\012' >
 $(GRASS_VERSION_FILE)
 }}}
 $/ is going missing from the middle of it. I'm not sure how to fix this
 though.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/595#comment:4>
GRASS GIS <http://grass.osgeo.org>

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

Re: [GRASS GIS] #595: WinGRASS g.version -c fails

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#595: WinGRASS g.version -c fails
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      Type:  defect        |      Status:  new                      
  Priority:  blocker       |   Milestone:  6.4.0                    
 Component:  License       |     Version:  6.4.0 RCs                
Resolution:                |    Keywords:  wingrass gpl            
  Platform:  MSWindows XP  |         Cpu:  x86-32                  
---------------------------+------------------------------------------------
Comment (by hamish):

 > When Makefile runs:
 {{{
 cat ./../../COPYING | sed -f sed.script | tr -d '\012' > /src/dev_6/dist.
 i686-pc-mingw32/etc/VERSION
 sed: file sed.script line 1: Unknown option to 's'
 }}}


 (sed.script contains {{{ s/.*$/&\\n/g }}})


 so what is this Makefile line doing exactly?
  - It's copying the COPYING file into the $GISBASE/etc/VERSION file
  - it's terminating each line with a literal '\n'
  - it's removing all actual newline chars from the file.

 So this is getting the file ready to be a string embedded in the C code.


 The g.version Makefile has it with comments:
 {{{
 # cat the COPYING file, add a c line-break \n at each line end
 # and remove the unix newline.
 COPYING=`cat ./../../COPYING | sed -f sed.script | tr -d '\012'`

 ...

 EXTRA_CFLAGS=-DVERSION_NUMBER=\"'$(VERSION_NUMBER)'\"
   -DVERSION_DATE=\"'$(VERSION_DATE)'\"
   -DVERSION_UPDATE_PKG=\"'$(VERSION_UPDATE_PKG)'\"
   -DCOPYING="\"$(COPYING)\""

 ...

 COPYING:
         cat ./../../COPYING | sed -f sed.script | tr -d '\012' >
 $(GRASS_VERSION_FILE)

 GRASS_CONFIGURE_PARAMS:
         head -n 7 ./../../config.status | tail -n 1 | sed 's+#++1' | tr -d
 '\012' > $(GRASS_BUILD_FILE)
 }}}

 On linux 'strings' shows the COPYING text within the binary, from the
 native WinGrass Msys prompt it doesn't.
 {{{
 strings `which g.version`
 }}}


 so the COPYING: ... > VERSION make rule could be simplified into a
 straight cp?

 interestingly the build info string does make it into the WinGrass binary
 and the $GISBASE/etc/BUILD file also has the correct content in it.


 ??,
 Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/595#comment:5>
GRASS GIS <http://grass.osgeo.org>

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

Re: [GRASS GIS] #595: WinGRASS g.version -c fails

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#595: WinGRASS g.version -c fails
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      Type:  defect        |      Status:  new                      
  Priority:  blocker       |   Milestone:  6.4.0                    
 Component:  License       |     Version:  6.4.0 RCs                
Resolution:                |    Keywords:  wingrass gpl            
  Platform:  MSWindows XP  |         Cpu:  x86-32                  
---------------------------+------------------------------------------------
Comment (by glynn):

 Replying to [comment:5 hamish]:

 > so what is this Makefile line doing exactly?
 >  - It's copying the COPYING file into the $GISBASE/etc/VERSION file
 >  - it's terminating each line with a literal '\n'
 >  - it's removing all actual newline chars from the file.
 >
 > So this is getting the file ready to be a string embedded in the C code.

 Yep.

 > The g.version Makefile has it with comments:
 {{{
 > EXTRA_CFLAGS=...

 >   -DCOPYING="\"$(COPYING)\""
 }}}

 > On linux 'strings' shows the COPYING text within the binary, from the
 native WinGrass Msys prompt it doesn't.

 I suspect that the -DCOPYING=... may run into problems with the maximum
 length of a command line on Windows.

 It would be better to convert the COPYING file to a complete C source file
 (including the quotes) which can then be #include'd. E.g.:

 {{{
 EXTRA_CFLAGS=-DGRASS_VERSION_FILE="\"$(GRASS_VERSION_FILE)\"" ...

 $(GRASS_VERSION_FILE): ../../COPYING
         sed -e 's/^.*$/"&\\n"/' $< > $@
 }}}

 and:
 {{{
 static const char COPYING[] =
 #include GRASS_VERSION_FILE
 ;
 }}}

 > so the COPYING: ... > VERSION make rule could be simplified into a
 straight cp?

 No. The VERSION file has "\n" instead of newline.

 Maybe it's provided as a convenience for add-on modules (nothing in the
 GRASS source tree uses it)?

 > interestingly the build info string does make it into the WinGrass
 binary and the $GISBASE/etc/BUILD file also has the correct content in it.

 I note that -DGRASS_CONFIGURE_PARAMS=... comes first; maybe the command
 gets truncated at that point (does g.version have the '''complete''' build
 command?)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/595#comment:6>
GRASS GIS <http://grass.osgeo.org>

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev