Details Ticket 4498


Comment | Reply | Take | Open


Serial Number 4498
Subject d.out.png script copied to docs/html/ in err
Area grass6
Queue grass
Requestors hamish_nospam@yahoo.com
Owner none
Status resolved
Last User Contact Thu May 25 14:45:46 2006 (2 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Thu May 25 14:45:46 2006 (2 yr ago)
Created Wed May 24 11:03:07 2006 (2 yr ago)

Transaction History Ticket 4498


Wed, May 24 2006 11:03:07    Request created by hbowman  
Subject: d.out.png script copied to docs/html/ in err

Hi,

I just noticed that the d.out.png script is copied to $GISBASE/docs/html/.
I guess the Makefile figures it is an image for the help page.


Hamish
Wed, May 24 2006 12:24:21    Mail sent by neteler@itc.it  
Return-Path <neteler@itc.it>
Delivered-To grass-bugs@lists.intevation.de
Message-ID <44743452.5070602@itc.it>
Date Wed, 24 May 2006 12:24:18 +0200
From Markus Neteler <neteler@itc.it>
User-Agent Mozilla Thunderbird 1.0.7-1.4.1 (X11/20050929)
X-Accept-Language en-us, en
MIME-Version 1.0
To Request Tracker <grass-bugs@intevation.de>
Cc grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #4498] (grass) d.out.png script copied to docs/html/ in err
References <20060524090307.F03081005D4@lists.intevation.de>
In-Reply-To <20060524090307.F03081005D4@lists.intevation.de>
X-Enigmail-Version 0.93.0.0
OpenPGP url=http://mpa.itc.it/markus/markus_gpgkey.asc
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-OriginalArrivalTime 24 May 2006 10:24:18.0767 (UTC) FILETIME=[3725BDF0:01C67F1C]
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
Request Tracker wrote:

>this bug's URL: http://intevation.de/rt/webrt?serial_num=4498
>-------------------------------------------------------------------------
>
>Subject: d.out.png script copied to docs/html/ in err
>
>Hi,
>
>I just noticed that the d.out.png script is copied to $GISBASE/docs/html/.
>I guess the Makefile figures it is an image for the help page.
>  
>

Right.

How to get

        -for file in  *.png *.jpg ; do \
                head -1 $$file | grep '#!/bin/sh' > /dev/null \
                if [ $$? -ne 0 ] ; then
                   $(INSTALL_DATA) $$file $(GISBASE)/docs/html \
                fi \
                done 2> /dev/null ; true

working (in include/Make/Html.make)?
The problem is that $$? isn't found. Maybe there is a less ugly trick to
test if
the first file of the $$file is a shell script.

Markus

>
>Hamish
>
>
>-------------------------------------------- Managed by Request Tracker
>
>_______________________________________________
>grass-dev mailing list
>grass-dev@grass.itc.it
>http://grass.itc.it/mailman/listinfo/grass-dev
>  
>


Wed, May 24 2006 17:00:59    Mail sent by wolf+grass@bergenheim.net  
Return-Path <wolf+grass@bergenheim.net>
Delivered-To grass-bugs@lists.intevation.de
Date Wed, 24 May 2006 18:00:43 +0300 (EEST)
From Wolf Bergenheim <wolf+grass@bergenheim.net>
To Markus Neteler <neteler@itc.it>
Cc Request Tracker <grass-bugs@intevation.de>, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #4498] (grass) d.out.png script copied to docs/html/ in err
In-Reply-To <44743452.5070602@itc.it>
Message-ID <Pine.LNX.4.64.0605241754220.5654@localhost.localdomain>
References <20060524090307.F03081005D4@lists.intevation.de> <44743452.5070602@itc.it>
MIME-Version 1.0
Content-Type TEXT/PLAIN; charset=US-ASCII; format=flowed
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
On Wed, 24 May 2006, Markus Neteler wrote:
>
> How to get
>
>        -for file in  *.png *.jpg ; do \
>                head -1 $$file | grep '#!/bin/sh' > /dev/null \
>                if [ $$? -ne 0 ] ; then
>                   $(INSTALL_DATA) $$file $(GISBASE)/docs/html \
>                fi \
>                done 2> /dev/null ; true
>
> working (in include/Make/Html.make)?
> The problem is that $$? isn't found. Maybe there is a less ugly trick to
> test if
> the first file of the $$file is a shell script.

I'm no expert but shouldn't
    -for file in  *.png *.jpg ; do \
         if [ ! -x $$file ] ; then \
            $(INSTALL_DATA) $$file $(GISBASE)/docs/html \
         fi \
         done 2> /dev/null ; true

do the trick since shellscript should be executable?

--W

-- 

<:3 )---- Wolf Bergenheim ----( 8:>


Wed, May 24 2006 17:13:08    Mail sent by grass4u@gmail.com  
Return-Path <grass4u@gmail.com>
Delivered-To grass-bugs@lists.intevation.de
DomainKey-Signature a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:from:to:cc:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=YsSUiFKaQYXuYDWlRxE3eV56By55vky/hbM5+qIo8tb6JRqLIgQc2DN8+f8csFYs9U36WzpeJcH1G25/hIqlvzScBaXHG/B1OwmxhD7+d/UM28w0cpLMd2VS947kS5E82EXFQ/uQ/5M77Hwp/NgI1geqXUjSyHyHGuwW9CCyVQE=
Date Wed, 24 May 2006 10:12:46 -0500
From Huidae Cho <grass4u@gmail.com>
To Wolf Bergenheim <wolf+grass@bergenheim.net>
Cc Markus Neteler <neteler@itc.it>, Request Tracker <grass-bugs@intevation.de>, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #4498] (grass) d.out.png script copied to docs/html/ in err
Message-ID <20060524151246.GB1035@localhost.tamu.edu>
References <20060524090307.F03081005D4@lists.intevation.de> <44743452.5070602@itc.it> <Pine.LNX.4.64.0605241754220.5654@localhost.localdomain>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <Pine.LNX.4.64.0605241754220.5654@localhost.localdomain>
User-Agent mutt-ng/devel (FreeBSD)
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
What about this?

         -for file in  *.png *.jpg ; do \
                 if [ `head -1 $$file` != '#!/bin/sh' ] ; then
                    $(INSTALL_DATA) $$file $(GISBASE)/docs/html \
                 fi \
          done 2> /dev/null ; true

Checking if a file is excutable could be unreliable in a certain environment.
Huidae Cho

On Wed, May 24, 2006 at 06:00:43PM +0300, Wolf Bergenheim wrote:
> On Wed, 24 May 2006, Markus Neteler wrote:
> >How to get
> >       -for file in  *.png *.jpg ; do \
> >               head -1 $$file | grep '#!/bin/sh' > /dev/null \
> >               if [ $$? -ne 0 ] ; then
> >                  $(INSTALL_DATA) $$file $(GISBASE)/docs/html \
> >               fi \
> >               done 2> /dev/null ; true
> >working (in include/Make/Html.make)?
> >The problem is that $$? isn't found. Maybe there is a less ugly trick to
> >test if
> >the first file of the $$file is a shell script.
> 
> I'm no expert but shouldn't
>     -for file in  *.png *.jpg ; do \
>          if [ ! -x $$file ] ; then \
>             $(INSTALL_DATA) $$file $(GISBASE)/docs/html \
>          fi \
>          done 2> /dev/null ; true
> 
> do the trick since shellscript should be executable?
> 
> --W
> 
> -- 
> 
> <:3 )---- Wolf Bergenheim ----( 8:>
> 
> _______________________________________________
> grass-dev mailing list
> grass-dev@grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev


Wed, May 24 2006 23:02:18    Mail sent by glynn@gclements.plus.com  
Return-Path <glynn@gclements.plus.com>
Delivered-To grass-bugs@lists.intevation.de
From Glynn Clements <glynn@gclements.plus.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Message-ID <17524.51669.852520.802597@cerise.gclements.plus.com>
Date Wed, 24 May 2006 22:02:13 +0100
To Markus Neteler <neteler@itc.it>
Cc Request Tracker <grass-bugs@intevation.de>, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #4498] (grass) d.out.png script copied to docs/html/ in err
In-Reply-To <44743452.5070602@itc.it>
References <20060524090307.F03081005D4@lists.intevation.de> <44743452.5070602@itc.it>
X-Mailer VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
Markus Neteler wrote:

> Request Tracker wrote:
> 
> >this bug's URL: http://intevation.de/rt/webrt?serial_num=4498
> >-------------------------------------------------------------------------
> >
> >Subject: d.out.png script copied to docs/html/ in err
> >
> >Hi,
> >
> >I just noticed that the d.out.png script is copied to $GISBASE/docs/html/.
> >I guess the Makefile figures it is an image for the help page.
> 
> Right.
> 
> How to get
> 
>         -for file in  *.png *.jpg ; do \
>                 head -1 $$file | grep '#!/bin/sh' > /dev/null \
>                 if [ $$? -ne 0 ] ; then
>                    $(INSTALL_DATA) $$file $(GISBASE)/docs/html \
>                 fi \
>                 done 2> /dev/null ; true
> 
> working (in include/Make/Html.make)?

Add some semicolons, and a backslash.

The above is equivalent to two separate command lines, both erroneous:

        -for file in  *.png *.jpg ; do head -1 $$file | grep '#!/bin/sh' > /dev/null
if [ $$? -ne 0 ] ; then
        $(INSTALL_DATA) $$file $(GISBASE)/docs/html ; fi done 2> /dev/null ;
true

The missing backslash after the "then" causes the command to be split
into two, each executed by a separate invocation of "/bin/sh -c ...";
as the do/done and if/fi are both split in half, that won't work. 
Also, the missing semicolons before the "if" and the "done" will
result in syntax errors.

Also, I would just check for #! at the beginning of the line;
#!/bin/sh is too specific (e.g. you could have a space after the #!,
or it might be a script in some other language). Any file which begins
with #! is treated as a script by the kernel (i.e. exec()ing the file
will execute the program whose path follows the #! with the script's
path given as an argument).

Finally, "head -n 1" may be more portable than "head -1" (recent
versions generate a warning).

Try:

        -for file in  *.png *.jpg ; do \
                head -n 1 $$file | grep '^#!' > /dev/null ; \
                if [ $$? -ne 0 ] ; then \
                   $(INSTALL_DATA) $$file $(GISBASE)/docs/html ; \
                fi \
                done 2> /dev/null ; true

-- 
Glynn Clements <glynn@gclements.plus.com>


Thu, May 25 2006 07:28:50    Mail sent by hamish_nospam@yahoo.com  
Return-Path <hamish_nospam@yahoo.com>
Delivered-To grass-bugs@lists.intevation.de
Date Thu, 25 May 2006 17:28:32 +1200
From Hamish <hamish_nospam@yahoo.com>
To Glynn Clements via RT <grass-bugs@intevation.de>
Cc grass-dev@grass.itc.it
Subject Re: [bug #4498] (grass) d.out.png script copied
Message-Id <20060525172832.156ba2b3.hamish_nospam@yahoo.com>
In-Reply-To <20060524210218.6845F1005D4@lists.intevation.de>
References <20060524210218.6845F1005D4@lists.intevation.de>
X-Mailer Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
X-Face M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Spam-Status No, hits=-4.0 tagged_above=-999.0 required=3.0 tests=BAYES_00, FORGED_YAHOO_RCVD
X-Spam-Level
> > >this bug's URL: http://intevation.de/rt/webrt?serial_num=4498
> > >------------------------------------------------------------------
..
> > >Subject: d.out.png script copied to docs/html/ in err
..
> >         -for file in  *.png *.jpg ; do \
> >                 head -1 $$file | grep '#!/bin/sh' > /dev/null \
..
> Also, I would just check for #! at the beginning of the line;
> #!/bin/sh is too specific (e.g. you could have a space after the #!,
> or it might be a script in some other language).

two points:

1) is it better to use `file $file | grep script` ? 
Is "file" as portable as "head -1|cut -c1-2" will i18n break the grep?

2) are we going about it from the wrong end: the above doesn't copy the
file if it _is a script_. Shouldn't the test not copy the file if it
_isn't an image_?


Hamish


Thu, May 25 2006 11:02:13    Mail sent by glynn@gclements.plus.com  
Return-Path <glynn@gclements.plus.com>
Delivered-To grass-bugs@lists.intevation.de
From Glynn Clements <glynn@gclements.plus.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Message-ID <17525.29301.447734.402783@cerise.gclements.plus.com>
Date Thu, 25 May 2006 10:01:41 +0100
To Hamish <hamish_nospam@yahoo.com>
Cc Glynn Clements via RT <grass-bugs@intevation.de>, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] Re: [bug #4498] (grass) d.out.png script copied
In-Reply-To <20060525172832.156ba2b3.hamish_nospam@yahoo.com>
References <20060524210218.6845F1005D4@lists.intevation.de> <20060525172832.156ba2b3.hamish_nospam@yahoo.com>
X-Mailer VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
Hamish wrote:

> > > >this bug's URL: http://intevation.de/rt/webrt?serial_num=4498
> > > >------------------------------------------------------------------
> ..
> > > >Subject: d.out.png script copied to docs/html/ in err
> ..
> > >         -for file in  *.png *.jpg ; do \
> > >                 head -1 $$file | grep '#!/bin/sh' > /dev/null \
> ..
> > Also, I would just check for #! at the beginning of the line;
> > #!/bin/sh is too specific (e.g. you could have a space after the #!,
> > or it might be a script in some other language).
> 
> two points:
> 
> 1) is it better to use `file $file | grep script` ? 
> Is "file" as portable as "head -1|cut -c1-2" will i18n break the grep?
> 
> 2) are we going about it from the wrong end: the above doesn't copy the
> file if it _is a script_. Shouldn't the test not copy the file if it
> _isn't an image_?

If you are going to use "file", it would be better to check that the
file is an image, rather than not a script. But using "file" is more
problematic, as it isn't part of the coreutils package, and its output
depends upon the "magic" file (which might conceivably be localised).

To identify scripts, "^#!" is reliable, as that's what the kernel
checks for when it's asked to execute a file.

-- 
Glynn Clements <glynn@gclements.plus.com>


Thu, May 25 2006 14:45:29    Status changed to resolved by mneteler  
Thu, May 25 2006 14:45:46    Mail sent by mneteler  
hi,

I have submitted Glynn's suggestion to CVS.

Markus
Comment | Reply | Take | Open

You are currently authenticated as guest.
[Show Configuration] [Login as another user]

Users Guide - Mail Commands - Homepage of RequestTracker 1.0.7 - list any request