Discussion:
Problems with Trigger Scripts and CVS Pre-Commit Hooks
Traiano Welcome
2010-07-24 09:50:46 UTC
Permalink
Hi List

I use cvs to manage BIND9 DNS zone files, and would like to create a
pre-commit hook that will run a syntax checker on the zone file before it's
committed. To do this, I have a shell wrapper that takes the name of the
zone file as an argument and formats a command for the syntax checker. The
shell wrapper is called from the commitinfo file as follows:

---
named.data/ZONES/* /usr/local/bin/checkzone %s
---

And "%s" is supposed to be expanded to the name of the zone file when any
file under " named.data/ZONES/" is committed. The checkzone script is as
follows:

---
#!/bin/sh -x
ZONE=`echo $1 | cut -d "." -f 2,3,4,5,6`
ZONE_FILE=DB.$ZONE
named-checkzone $ZONE $ZONE_FILE
---

However, when I run the commit, the debug information shows the "%s"
variable is not being expanded to the name of the file, consequently the
shell script does not get the correct argument and the commit fails:

---
[***@box ~/named.data/ZONES]$ cvs commit DB.evasive.co.za

+ cut -d . -f 2,3,4,5,6
+ echo %s
+ ZONE=%s
+ ZONE_FILE=DB.%s
+ named-checkzone %s DB.%s

zone %s/IN: loading from master file DB.%s failed: file not found

cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!

---


Please could someone help me shed some light on this for me? I suspect it's
somehow related to the environment the script is being run in, but the
details escape me, and why "%s" is not being expanded is also beyond me at
the moment :-P

Thanks in Advance,
Traiano Welcome







NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.
Yaron Yogev
2010-07-26 07:31:38 UTC
Permalink
Hi,

Could you post the relevant line from the commitinfo file in CVSROOT
directory your repository ?

I have a similar case, and the commitinfo line looks like this:
ALL /usr/local/bin/cvs_commit_verify %r %p %m %{s}

- ALL: means the script is called for any commit
- /usr/local/bin/cvs_commit_verify: the name of the script to run
(the rest of the explanations I just copied from the commitinfo
header)
- %r = repository (path portion of $CVSROOT)
- %p = path relative to repository
- %m = log message
- %{s} = file name, file name, ...

Yaron

On Jul 24, 12:50 pm, Traiano Welcome
Post by Traiano Welcome
Hi List
I use cvs to manage BIND9 DNS zone files, and would like to create a
pre-commit hook that will run a syntax checker on the zone file before it's
committed. To do this, I have a shell wrapper that takes the name of the
zone file as an argument and formats a command for the syntax checker. The
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
And "%s" is supposed to be expanded to the name of the zone file when any
file under " named.data/ZONES/" is committed. The checkzone script is as
---
#!/bin/sh -x
ZONE=`echo $1 | cut -d "." -f  2,3,4,5,6`
ZONE_FILE=DB.$ZONE
named-checkzone $ZONE $ZONE_FILE
---
However, when I run the commit, the debug information shows the "%s"
variable is not being expanded to the name of the file, consequently the
---
+ cut -d . -f 2,3,4,5,6
+ echo %s
+ ZONE=%s
+ ZONE_FILE=DB.%s
+ named-checkzone %s DB.%s
zone %s/IN: loading from master file DB.%s failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
---
Please could someone help me shed some light on this for me? I suspect it's
somehow related to the environment the script is being run in, but the
details escape me, and why "%s" is not being expanded is also beyond me at
the moment :-P
Thanks in Advance,
Traiano Welcome
NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.
Traiano Welcome
2010-07-27 07:24:25 UTC
Permalink
Hi Yaron

The specific line is as follows:

---
named.data/ZONES/* /usr/local/bin/checkzone %s
---

This line is preceded by:

---
ALL $CVSROOT/CVSROOT/checkscript
---

Which is a script run on all files commited.

Traiano


On 2010/07/26 9:31 AM, "Yaron Yogev" <***@gmail.com> wrote:

Hi,

Could you post the relevant line from the commitinfo file in CVSROOT
directory your repository ?

I have a similar case, and the commitinfo line looks like this:
ALL /usr/local/bin/cvs_commit_verify %r %p %m %{s}

- ALL: means the script is called for any commit
- /usr/local/bin/cvs_commit_verify: the name of the script to run
(the rest of the explanations I just copied from the commitinfo
header)
- %r = repository (path portion of $CVSROOT)
- %p = path relative to repository
- %m = log message
- %{s} = file name, file name, ...

Yaron

On Jul 24, 12:50 pm, Traiano Welcome
Post by Traiano Welcome
Hi List
I use cvs to manage BIND9 DNS zone files, and would like to create a
pre-commit hook that will run a syntax checker on the zone file before it's
committed. To do this, I have a shell wrapper that takes the name of the
zone file as an argument and formats a command for the syntax checker. The
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
And "%s" is supposed to be expanded to the name of the zone file when any
file under " named.data/ZONES/" is committed. The checkzone script is as
---
#!/bin/sh -x
ZONE=`echo $1 | cut -d "." -f 2,3,4,5,6`
ZONE_FILE=DB.$ZONE
named-checkzone $ZONE $ZONE_FILE
---
However, when I run the commit, the debug information shows the "%s"
variable is not being expanded to the name of the file, consequently the
---
+ cut -d . -f 2,3,4,5,6
+ echo %s
+ ZONE=%s
+ ZONE_FILE=DB.%s
+ named-checkzone %s DB.%s
zone %s/IN: loading from master file DB.%s failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
---
Please could someone help me shed some light on this for me? I suspect it's
somehow related to the environment the script is being run in, but the
details escape me, and why "%s" is not being expanded is also beyond me at
the moment :-P
Thanks in Advance,
Traiano Welcome
NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.
________________________________
NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.
Yaron Yogev
2010-07-27 08:42:45 UTC
Permalink
Hi,

change %s --> %{s}

Yaron

On Jul 27, 10:24 am, Traiano Welcome
Post by Traiano Welcome
Hi Yaron
 ---
named.data/ZONES/* /usr/local/bin/checkzone %s
 ---
---
ALL            $CVSROOT/CVSROOT/checkscript
---
Which is a script run on all files commited.
Traiano
Hi,
Could you post the relevant line from the commitinfo file in CVSROOT
directory your repository ?
ALL /usr/local/bin/cvs_commit_verify  %r %p %m %{s}
- ALL: means the script is called for any commit
- /usr/local/bin/cvs_commit_verify: the name of the script to run
(the rest of the explanations I just copied from the commitinfo
header)
- %r = repository (path portion of $CVSROOT)
- %p = path relative to repository
- %m = log message
- %{s} = file name, file name, ...
Yaron
On Jul 24, 12:50 pm, Traiano Welcome
Post by Traiano Welcome
Hi List
I use cvs to manage BIND9 DNS zone files, and would like to create a
pre-commit hook that will run a syntax checker on the zone file before it's
committed. To do this, I have a shell wrapper that takes the name of the
zone file as an argument and formats a command for the syntax checker. The
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
And "%s" is supposed to be expanded to the name of the zone file when any
file under " named.data/ZONES/" is committed. The checkzone script is as
---
#!/bin/sh -x
ZONE=`echo $1 | cut -d "." -f  2,3,4,5,6`
ZONE_FILE=DB.$ZONE
named-checkzone $ZONE $ZONE_FILE
---
However, when I run the commit, the debug information shows the "%s"
variable is not being expanded to the name of the file, consequently the
---
+ cut -d . -f 2,3,4,5,6
+ echo %s
+ ZONE=%s
+ ZONE_FILE=DB.%s
+ named-checkzone %s DB.%s
zone %s/IN: loading from master file DB.%s failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
---
Please could someone help me shed some light on this for me? I suspect it's
somehow related to the environment the script is being run in, but the
details escape me, and why "%s" is not being expanded is also beyond me at
the moment :-P
Thanks in Advance,
Traiano Welcome
NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.
________________________________
NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.
Traiano Welcome
2010-07-27 09:51:17 UTC
Permalink
No luck, from the debug below, I see "%{s}" being interpreted literally:

---

[***@box ~/cvswork/ZONES]$ cvs commit DB.evasive.org.za

+ echo %{s}
+ cut -d . -f 2,3,4,5,6
+ ZONE=%{s}
+ ZONE_FILE=DB.%{s}
+ named-checkzone %{s} DB.%{s}

zone %{s}/IN: loading from master file DB.%{s} failed: file not found

cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!

----
Post by Yaron Yogev
Hi,
change %s --> %{s}
Yaron
On Jul 27, 10:24 am, Traiano Welcome
Post by Traiano Welcome
Hi Yaron
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
---
ALL $CVSROOT/CVSROOT/checkscript
---
Which is a script run on all files commited.
Traiano
Hi,
Could you post the relevant line from the commitinfo file in CVSROOT
directory your repository ?
ALL /usr/local/bin/cvs_commit_verify %r %p %m %{s}
- ALL: means the script is called for any commit
- /usr/local/bin/cvs_commit_verify: the name of the script to run
(the rest of the explanations I just copied from the commitinfo
header)
- %r = repository (path portion of $CVSROOT)
- %p = path relative to repository
- %m = log message
- %{s} = file name, file name, ...
Yaron
On Jul 24, 12:50 pm, Traiano Welcome
Post by Traiano Welcome
Hi List
I use cvs to manage BIND9 DNS zone files, and would like to create a
pre-commit hook that will run a syntax checker on the zone file before it's
committed. To do this, I have a shell wrapper that takes the name of the
zone file as an argument and formats a command for the syntax checker. The
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
And "%s" is supposed to be expanded to the name of the zone file when any
file under " named.data/ZONES/" is committed. The checkzone script is as
---
#!/bin/sh -x
ZONE=`echo $1 | cut -d "." -f 2,3,4,5,6`
ZONE_FILE=DB.$ZONE
named-checkzone $ZONE $ZONE_FILE
---
However, when I run the commit, the debug information shows the "%s"
variable is not being expanded to the name of the file, consequently the
---
+ cut -d . -f 2,3,4,5,6
+ echo %s
+ ZONE=%s
+ ZONE_FILE=DB.%s
+ named-checkzone %s DB.%s
zone %s/IN: loading from master file DB.%s failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
---
Please could someone help me shed some light on this for me? I suspect it's
somehow related to the environment the script is being run in, but the
details escape me, and why "%s" is not being expanded is also beyond me at
the moment :-P
Thanks in Advance,
Traiano Welcome
NOTE: This e-mail message and all attachments thereto contain confidential
information intended for a specific addressee and purpose. If you are not
the addressee (a) you may not disclose, copy, distribute or take any action
based on the contents hereof; (b) kindly inform the sender immediately and
destroy all copies hereof. Any copying, publication or disclosure of this
message, or part hereof, in any form whatsoever, without the sender's
express written consent, is prohibited. No opinion expressed or implied by
the sender necessarily constitutes the opinion of MTN. This message does not
constitute a guarantee or proof of the facts mentioned herein. No Employee
or intermediary is authorised to conclude a binding agreement on behalf of
MTN Group Limited, or any of its subsidiary companies, by e-mail without the
express written confirmation by a duly authorised representative of MTN
Group Limited.
________________________________
NOTE: This e-mail message and all attachments thereto contain confidential
information intended for a specific addressee and purpose. If you are not the
addressee (a) you may not disclose, copy, distribute or take any action based
on the contents hereof; (b) kindly inform the sender immediately and destroy
all copies hereof. Any copying, publication or disclosure of this message, or
part hereof, in any form whatsoever, without the sender's express written
consent, is prohibited. No opinion expressed or implied by the sender
necessarily constitutes the opinion of MTN. This message does not constitute
a guarantee or proof of the facts mentioned herein. No Employee or
intermediary is authorised to conclude a binding agreement on behalf of MTN
Group Limited, or any of its subsidiary companies, by e-mail without the
express written confirmation by a duly authorised representative of MTN Group
Limited.
NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.
Bulgrien, Kevin
2010-07-27 14:15:36 UTC
Permalink
-----Original Message-----
g] On Behalf Of Traiano Welcome
Sent: Tuesday, July 27, 2010 4:51 AM
Subject: Re: Problems with Trigger Scripts and CVS Pre-Commit Hooks
No luck, from the debug below, I see "%{s}" being interpreted
---
+ echo %{s}
+ cut -d . -f 2,3,4,5,6
+ ZONE=%{s}
+ ZONE_FILE=DB.%{s}
+ named-checkzone %{s} DB.%{s}
zone %{s}/IN: loading from master file DB.%{s} failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
----
I am pretty sure he meant for you to try %{s} in the commitinfo
file itself, and not in the hook script.

ie.
named.data/ZONES/* /usr/local/bin/checkzone %{s}

I have a postcommit script that says the following in its header
comment:

# $Id: postcommit.sh,v 1.9 2006/08/17 17:12:00 cvsadm Exp $
#
# CVSROOT loginfo should contain:
# ALL /home/eden/cvs/scripts/postcommit.sh %{sVv}
#
# This creates the following script parameter format:
# module file1,oldversion,newversion file2,oldversion,newversion ...
#
# The script runs as the user doing the commit.

Your commitinfo says %s, not %{s}, but of course it is a precommit
rather than a postcommit, and perhaps there is a difference, and
maybe it is optional. (I do not remember the details on the syntax
since it has been 4 years since I wrote the script.) I'd at least
try the curly braces in the commitinfo and not in the shell script.

---
Kevin R. Bulgrien
Post by Yaron Yogev
Hi,
change %s --> %{s}
Yaron
On Jul 27, 10:24 am, Traiano Welcome
Post by Traiano Welcome
Hi Yaron
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
This message and/or attachments may include information subject to GD Corporate Policy 07-105 and is intended to be accessed only by authorized personnel of General Dynamics and approved service providers. Use, storage and transmission are governed by General Dynamics and its policies. Contractual restrictions apply to third parties. Recipients should refer to the policies or contract to determine proper handling. Unauthorized review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please contact the sender and destroy all copies of the original message.
Bulgrien, Kevin
2010-07-27 14:38:10 UTC
Permalink
It seems %{sVv} notation is for the post-commit hook. Nothing I see
in pre-commit hook documentation says anything about this notation.
GIYF.

For pre-commit hooks, $1 appears to be the module and the rest of
the parameters are the individual files.

Ie. http://pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/LettingCVSPullTheTrigger.rdoc/style/print

This basically means in the script you have to use standard shell
parameter notation, not %s.

---
Kevin R. Bulgrien
-----Original Message-----
From: Bulgrien, Kevin
Sent: Tuesday, July 27, 2010 9:16 AM
Subject: RE: Problems with Trigger Scripts and CVS Pre-Commit Hooks
-----Original Message-----
g] On Behalf Of Traiano Welcome
Sent: Tuesday, July 27, 2010 4:51 AM
Subject: Re: Problems with Trigger Scripts and CVS Pre-Commit Hooks
---
+ echo %{s}
+ cut -d . -f 2,3,4,5,6
+ ZONE=%{s}
+ ZONE_FILE=DB.%{s}
+ named-checkzone %{s} DB.%{s}
zone %{s}/IN: loading from master file DB.%{s} failed: file
not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
----
I am pretty sure he meant for you to try %{s} in the commitinfo
file itself, and not in the hook script.
ie.
named.data/ZONES/* /usr/local/bin/checkzone %{s}
I have a postcommit script that says the following in its header
# $Id: postcommit.sh,v 1.9 2006/08/17 17:12:00 cvsadm Exp $
#
# ALL /home/eden/cvs/scripts/postcommit.sh %{sVv}
#
# module file1,oldversion,newversion file2,oldversion,newversion ...
#
# The script runs as the user doing the commit.
Your commitinfo says %s, not %{s}, but of course it is a precommit
rather than a postcommit, and perhaps there is a difference, and
maybe it is optional. (I do not remember the details on the syntax
since it has been 4 years since I wrote the script.) I'd at least
try the curly braces in the commitinfo and not in the shell script.
---
Kevin R. Bulgrien
Post by Yaron Yogev
Hi,
change %s --> %{s}
Yaron
On Jul 27, 10:24 am, Traiano Welcome
Post by Traiano Welcome
Hi Yaron
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
This message and/or attachments may include information subject to GD Corporate Policy 07-105 and is intended to be accessed only by authorized personnel of General Dynamics and approved service providers. Use, storage and transmission are governed by General Dynamics and its policies. Contractual restrictions apply to third parties. Recipients should refer to the policies or contract to determine proper handling. Unauthorized review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please contact the sender and destroy all copies of the original message.
Yaron Yogev
2010-07-27 09:59:14 UTC
Permalink
On Jul 27, 12:51 pm, Traiano Welcome
Post by Traiano Welcome
---
+ echo %{s}
+ cut -d . -f 2,3,4,5,6
+ ZONE=%{s}
+ ZONE_FILE=DB.%{s}
+ named-checkzone %{s} DB.%{s}
zone %{s}/IN: loading from master file DB.%{s} failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
----
Post by Yaron Yogev
Hi,
change %s --> %{s}
Yaron
On Jul 27, 10:24 am, Traiano Welcome
Post by Traiano Welcome
Hi Yaron
 ---
named.data/ZONES/* /usr/local/bin/checkzone %s
 ---
---
ALL            $CVSROOT/CVSROOT/checkscript
---
Which is a script run on all files commited.
Traiano
Hi,
Could you post the relevant line from the commitinfo file in CVSROOT
directory your repository ?
ALL /usr/local/bin/cvs_commit_verify  %r %p %m %{s}
- ALL: means the script is called for any commit
- /usr/local/bin/cvs_commit_verify: the name of the script to run
(the rest of the explanations I just copied from the commitinfo
header)
- %r = repository (path portion of $CVSROOT)
- %p = path relative to repository
- %m = log message
- %{s} = file name, file name, ...
Yaron
On Jul 24, 12:50 pm, Traiano Welcome
Post by Traiano Welcome
Hi List
I use cvs to manage BIND9 DNS zone files, and would like to create a
pre-commit hook that will run a syntax checker on the zone file before it's
committed. To do this, I have a shell wrapper that takes the name of the
zone file as an argument and formats a command for the syntax checker. The
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
And "%s" is supposed to be expanded to the name of the zone file when any
file under " named.data/ZONES/" is committed. The checkzone script is as
---
#!/bin/sh -x
ZONE=`echo $1 | cut -d "." -f  2,3,4,5,6`
ZONE_FILE=DB.$ZONE
named-checkzone $ZONE $ZONE_FILE
---
However, when I run the commit, the debug information shows the "%s"
variable is not being expanded to the name of the file, consequently the
---
+ cut -d . -f 2,3,4,5,6
+ echo %s
+ ZONE=%s
+ ZONE_FILE=DB.%s
+ named-checkzone %s DB.%s
zone %s/IN: loading from master file DB.%s failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
---
Please could someone help me shed some light on this for me? I suspect it's
somehow related to the environment the script is being run in, but the
details escape me, and why "%s" is not being expanded is also beyond me at
the moment :-P
Thanks in Advance,
Traiano Welcome
Try adding a simple debug line in commitinfo, something like:
ALL echo got pre-commit of files: %{s} >> /tmp/pre_commit_log.txt

See if the contents of /tmp/pre_commit_log.txt contain the correct
file name(s).

Yaron
Arthur Barrett
2010-07-27 12:24:16 UTC
Permalink
Traiano Welcome,

Which version of CVS? Eg: 1.12.1 server and 1.11.1 client

What connection string (sometimes called $CVSROOT), eg:
:pserver:host:/repo

Which operating system? Eg: Red hat Entperprise Linux 5u4 server, sun
solaris sparc 9 client

Regards,


Arthur
-----Original Message-----
org] On Behalf Of Traiano Welcome
Sent: Saturday, 24 July 2010 7:51 PM
Subject: Problems with Trigger Scripts and CVS Pre-Commit Hooks
Hi List
I use cvs to manage BIND9 DNS zone files, and would like to create a
pre-commit hook that will run a syntax checker on the zone
file before it's
committed. To do this, I have a shell wrapper that takes the
name of the
zone file as an argument and formats a command for the syntax
checker. The
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
And "%s" is supposed to be expanded to the name of the zone
file when any
file under " named.data/ZONES/" is committed. The checkzone
script is as
---
#!/bin/sh -x
ZONE=`echo $1 | cut -d "." -f 2,3,4,5,6`
ZONE_FILE=DB.$ZONE
named-checkzone $ZONE $ZONE_FILE
---
However, when I run the commit, the debug information shows the "%s"
variable is not being expanded to the name of the file,
consequently the
---
+ cut -d . -f 2,3,4,5,6
+ echo %s
+ ZONE=%s
+ ZONE_FILE=DB.%s
+ named-checkzone %s DB.%s
zone %s/IN: loading from master file DB.%s failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
---
Please could someone help me shed some light on this for me?
I suspect it's
somehow related to the environment the script is being run in, but the
details escape me, and why "%s" is not being expanded is also
beyond me at
the moment :-P
Thanks in Advance,
Traiano Welcome
NOTE: This e-mail message and all attachments thereto contain
confidential information intended for a specific addressee
and purpose. If you are not the addressee (a) you may not
disclose, copy, distribute or take any action based on the
contents hereof; (b) kindly inform the sender immediately and
destroy all copies hereof. Any copying, publication or
disclosure of this message, or part hereof, in any form
whatsoever, without the sender's express written consent, is
prohibited. No opinion expressed or implied by the sender
necessarily constitutes the opinion of MTN. This message does
not constitute a guarantee or proof of the facts mentioned
herein. No Employee or intermediary is authorised to conclude
a binding agreement on behalf of MTN Group Limited, or any of
its subsidiary companies, by e-mail without the express
written confirmation by a duly authorised representative of
MTN Group Limited.
Traiano Welcome
2010-07-27 13:22:52 UTC
Permalink
Arthur Barret,

---
Concurrent Versions System (CVS) 1.11.5-FreeBSD (client/server)
---

O.S:

---
6.2-STABLE FreeBSD 6.2-STABLE #0: Sun Feb 18 15:18:46 SAST 2007
---

$CVSROOT (I think you mean:) ...:

----
/home/cvsroot/named.data/ZONES/
---

Thanks in Advance,
Traiano

On 2010/07/27 2:24 PM, "Arthur Barrett" <***@march-hare.com> wrote:

Traiano Welcome,

Which version of CVS? Eg: 1.12.1 server and 1.11.1 client

What connection string (sometimes called $CVSROOT), eg:
:pserver:host:/repo

Which operating system? Eg: Red hat Entperprise Linux 5u4 server, sun
solaris sparc 9 client

Regards,


Arthur
-----Original Message-----
org] On Behalf Of Traiano Welcome
Sent: Saturday, 24 July 2010 7:51 PM
Subject: Problems with Trigger Scripts and CVS Pre-Commit Hooks
Hi List
I use cvs to manage BIND9 DNS zone files, and would like to create a
pre-commit hook that will run a syntax checker on the zone
file before it's
committed. To do this, I have a shell wrapper that takes the
name of the
zone file as an argument and formats a command for the syntax
checker. The
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
And "%s" is supposed to be expanded to the name of the zone
file when any
file under " named.data/ZONES/" is committed. The checkzone
script is as
---
#!/bin/sh -x
ZONE=`echo $1 | cut -d "." -f 2,3,4,5,6`
ZONE_FILE=DB.$ZONE
named-checkzone $ZONE $ZONE_FILE
---
However, when I run the commit, the debug information shows the "%s"
variable is not being expanded to the name of the file,
consequently the
---
+ cut -d . -f 2,3,4,5,6
+ echo %s
+ ZONE=%s
+ ZONE_FILE=DB.%s
+ named-checkzone %s DB.%s
zone %s/IN: loading from master file DB.%s failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
---
Please could someone help me shed some light on this for me?
I suspect it's
somehow related to the environment the script is being run in, but the
details escape me, and why "%s" is not being expanded is also
beyond me at
the moment :-P
Thanks in Advance,
Traiano Welcome
NOTE: This e-mail message and all attachments thereto contain
confidential information intended for a specific addressee
and purpose. If you are not the addressee (a) you may not
disclose, copy, distribute or take any action based on the
contents hereof; (b) kindly inform the sender immediately and
destroy all copies hereof. Any copying, publication or
disclosure of this message, or part hereof, in any form
whatsoever, without the sender's express written consent, is
prohibited. No opinion expressed or implied by the sender
necessarily constitutes the opinion of MTN. This message does
not constitute a guarantee or proof of the facts mentioned
herein. No Employee or intermediary is authorised to conclude
a binding agreement on behalf of MTN Group Limited, or any of
its subsidiary companies, by e-mail without the express
written confirmation by a duly authorised representative of
MTN Group Limited.
________________________________
NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.
Traiano Welcome
2010-07-27 14:38:35 UTC
Permalink
Hi Bulgrien
-----Original Message-----
g] On Behalf Of Traiano Welcome
Sent: Tuesday, July 27, 2010 4:51 AM
Subject: Re: Problems with Trigger Scripts and CVS Pre-Commit Hooks
No luck, from the debug below, I see "%{s}" being interpreted
---
+ echo %{s}
+ cut -d . -f 2,3,4,5,6
+ ZONE=%{s}
+ ZONE_FILE=DB.%{s}
+ named-checkzone %{s} DB.%{s}
zone %{s}/IN: loading from master file DB.%{s} failed: file not found
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!
----
I am pretty sure he meant for you to try %{s} in the commitinfo
file itself, and not in the hook script.
Yes, what you're seeing is the debug output from callng "sh" in the script
with the "-x" option, i.e you see what the script interpreted the variable
"%{s}" as ... " named.data/ZONES/* /usr/local/bin/checkzone %{s}" is
exactly what I have in the commitinfo file, but the debug output from
+ echo %{s}
+ cut -d . -f 2,3,4,5,6
+ ZONE=%{s}
+ ZONE_FILE=DB.%{s}
+ named-checkzone %{s} DB.%{s}
I.e "%{s}" is not exanded to the name of the file, but processed by the
script as a literal "%{s}" :-(
ie.
named.data/ZONES/* /usr/local/bin/checkzone %{s}
I have a postcommit script that says the following in its header
# $Id: postcommit.sh,v 1.9 2006/08/17 17:12:00 cvsadm Exp $
#
# ALL /home/eden/cvs/scripts/postcommit.sh %{sVv}
#
# module file1,oldversion,newversion file2,oldversion,newversion ...
#
# The script runs as the user doing the commit.
Your commitinfo says %s, not %{s}, but of course it is a precommit
I've looked at 2 different versions of the CVS manual, and it seems like
%{s} and %s are interpreted the same ... I've tested both and (when they're
interpreted), they both work ...
rather than a postcommit, and perhaps there is a difference, and
maybe it is optional. (I do not remember the details on the syntax
since it has been 4 years since I wrote the script.) I'd at least
try the curly braces in the commitinfo and not in the shell script.
---
Kevin R. Bulgrien
Post by Yaron Yogev
Hi,
change %s --> %{s}
Yaron
On Jul 27, 10:24 am, Traiano Welcome
Post by Traiano Welcome
Hi Yaron
---
named.data/ZONES/* /usr/local/bin/checkzone %s
---
This message and/or attachments may include information subject to GD
Corporate Policy 07-105 and is intended to be accessed only by authorized
personnel of General Dynamics and approved service providers. Use, storage
and transmission are governed by General Dynamics and its policies.
Contractual restrictions apply to third parties. Recipients should refer to
the policies or contract to determine proper handling. Unauthorized review,
use, disclosure or distribution is prohibited. If you are not an intended
recipient, please contact the sender and destroy all copies of the original
message.
NOTE: This e-mail message and all attachments thereto contain confidential information intended for a specific addressee and purpose. If you are not the addressee (a) you may not disclose, copy, distribute or take any action based on the contents hereof; (b) kindly inform the sender immediately and destroy all copies hereof. Any copying, publication or disclosure of this message, or part hereof, in any form whatsoever, without the sender's express written consent, is prohibited. No opinion expressed or implied by the sender necessarily constitutes the opinion of MTN. This message does not constitute a guarantee or proof of the facts mentioned herein. No Employee or intermediary is authorised to conclude a binding agreement on behalf of MTN Group Limited, or any of its subsidiary companies, by e-mail without the express written confirmation by a duly authorised representative of MTN Group Limited.
Larry Jones
2010-07-27 15:24:08 UTC
Permalink
Post by Traiano Welcome
I've looked at 2 different versions of the CVS manual, and it seems like
%{s} and %s are interpreted the same ... I've tested both and (when they're
interpreted), they both work ...
You need to look at the manual for the version you're using -- you're
looking at CVS 1.12 manuals but running CVS 1.11, which doesn't support
substitutions for commitinfo. See the right manual for details:

<http://ximbiot.com/cvs/manual/cvs-1.11.23/cvs_18.html#SEC182>
--
Larry Jones

Hmm... That might not be politic. -- Calvin
Loading...