[DRBD-cvs] r1804 - in branches/drbd-0.7: . user

www-data www-data at garcon.linbit.com
Mon May 30 19:00:14 CEST 2005


Author: lars
Date: 2005-05-30 19:00:13 +0200 (Mon, 30 May 2005)
New Revision: 1804

Modified:
   branches/drbd-0.7/Makefile
   branches/drbd-0.7/user/drbdadm_scanner.fl
Log:
* makefile update for internal use
* fixed flex input buffer overflow:
  drbdadm_scanner.fl produced tokens of arbitrary length due to excessive use
  of "+" and "*" modifiers. Now these are replaced with "{x,y}" modifiers, so
  it should no longer segfault.
  Though it may now produce parse errors where it suceeded before, if you
  happen to use 90 character long resource names or the like.



Modified: branches/drbd-0.7/Makefile
===================================================================
--- branches/drbd-0.7/Makefile	2005-05-24 08:28:52 UTC (rev 1803)
+++ branches/drbd-0.7/Makefile	2005-05-30 17:00:13 UTC (rev 1804)
@@ -32,11 +32,16 @@
 # or to forcefully include the svn-last-changed-date in the tgz name:
 #   make distclean doc tgz FORCE=1
 #
-REL_VERSION := $(REL_VERSION)-$(shell svn info| \
-		  sed -ne 's/^Last Changed Date: \([0-9]*\)-\([0-9]*\)-\([0-9]*\).*/\1\2\3/p')
+REL_VERSION := $(REL_VERSION)-$(shell LANG= svn info| \
+	sed -n -e 's/^Last Changed Date: \([0-9]*\)-\([0-9]*\)-\([0-9]*\).*/\1\2\3/p' \
+	)-$(shell svnversion .)
 endif
 
 DIST_VERSION := $(subst -,_,$(REL_VERSION))
+FDIST_VERSION := $(shell sed -ne 's,^drbd-\([^/]*\)/.*,\1,p;q' < .filelist)
+ifeq ($(FDIST_VERSION),)
+FDIST_VERSION := $(DIST_VERSION)
+endif
 
 LN_S = ln -s
 RPMBUILD=rpmbuild
@@ -139,23 +144,28 @@
 tgz:
 	test -e .filelist
 	ln -sf drbd/linux/drbd_config.h drbd_config.h
-	rm -f drbd-$(DIST_VERSION)
-	ln -s . drbd-$(DIST_VERSION)
+	rm -f drbd-$(FDIST_VERSION)
+	ln -s . drbd-$(FDIST_VERSION)
 	set -e ; for f in $$(<.filelist) ; do [ -e $$f ] ; done
-	tar --owner=0 --group=0 -czf drbd-$(DIST_VERSION).tar.gz -T .filelist
-	rm drbd-$(DIST_VERSION)
+	grep debian .filelist >/dev/null 2>&1 && _DEB=-debian || _DEB="" ; \
+	tar --owner=0 --group=0 -czf drbd-$(FDIST_VERSION)$$_DEB.tar.gz -T .filelist
+	rm drbd-$(FDIST_VERSION)
 
 ifeq ($(FORCE),)
 tgz: check_changelogs_up2date doc
 endif
 
 check_all_committed:
-	@modified=`svn st -q`; 		\
+	@$(if $(FORCE),-,)modified=`svn st -q`; 		\
 	if test -n "$$modified" ; then	\
 		echo "$$modified";	\
 	       	false;			\
 	fi
 
+prepare_release:
+	$(MAKE) tarball
+	$(MAKE) tarball PRESERVE_DEBIAN=1
+
 tarball: check_all_committed distclean doc .filelist tgz
 all tools doc .filelist: drbd/drbd_buildtag.c
 
@@ -181,11 +191,11 @@
 	         dist/TMP \
 	         dist/install \
 	         dist/SRPMS
-	[ -h dist/SOURCES/drbd-$(DIST_VERSION).tar.gz ] || \
-	  $(LN_S) $(PWD)/drbd-$(DIST_VERSION).tar.gz \
-	          $(PWD)/dist/SOURCES/drbd-$(DIST_VERSION).tar.gz
+	[ -h dist/SOURCES/drbd-$(FDIST_VERSION).tar.gz ] || \
+	  $(LN_S) $(PWD)/drbd-$(FDIST_VERSION).tar.gz \
+	          $(PWD)/dist/SOURCES/drbd-$(FDIST_VERSION).tar.gz
 	if test drbd.spec.in -nt dist/SPECS/drbd.spec ; then \
-	   sed -e "s/^\(Version:\).*/\1 $(DIST_VERSION)/;" \
+	   sed -e "s/^\(Version:\).*/\1 $(FDIST_VERSION)/;" \
 	       -e "s/^\(Packager:\).*/\1 $(USER)@$(HOSTNAME)/;" < drbd.spec.in \
 	   > dist/SPECS/drbd.spec ; \
 	fi

Modified: branches/drbd-0.7/user/drbdadm_scanner.fl
===================================================================
--- branches/drbd-0.7/user/drbdadm_scanner.fl	2005-05-24 08:28:52 UTC (rev 1803)
+++ branches/drbd-0.7/user/drbdadm_scanner.fl	2005-05-30 17:00:13 UTC (rev 1804)
@@ -31,16 +31,6 @@
  *		-- lge
  */ 
 
-/*
- * Philipp dislikes syntax diversity, and wants terminating semicolons.
- * So I drop what I thought would be nice to have: plain English and
- * punctuation...
-ASSIGN			  {LS}*[:=]{LS}*|{LS}(is{LS})?
-DISK			  disk|"on top of"
-IGNORE			  ({WSC}*(use|with)*)+
-NDELIM			  [^ \t\n#=:;{}]+
-*/
-
 %}
 
 %option noyywrap
@@ -51,29 +41,31 @@
 %x SEMICOLON ASSIGN NUM NUM_U NAME STRING PROTO IO_ERROR ON_DISCONNECT
 %x IP_AND_PORT PORT META_DISK META_IDX
 %x LS LBRACE IGNORE_SECTION
+%x COMMENT
 
-LS			  [ \t]+
-WS			  [ \t\n]+
-COMMENT			  \#[^\n]*
-WSC			  ({WS}|{COMMENT}\n)+
+LS			  [ \t]{1,80}
+WS			  ({LS}|\n)
+COMMENT_START		  \#
 ASSIGN			  {LS}
 OUT_OF_RANGE_NUM	  [0-9]{10,}[kmgKMG]? 
 NUM			  [0-9]{1,9}
 NUM_U			  [0-9]{1,9}[kmgKMG]? 
-NAME			  [/_.A-Za-z0-9-]+
-STRING			  ({NAME}|\"([^\"\\\n]*|\\.)*\")+
-USTRING			  \"([^\"\\\n]*|\\.)*
+NAME			  [/_.A-Za-z0-9-]{1,80}
+ENAME			  [/_.A-Za-z0-9-]{81}
+L_NO_DQUOTES		  [^\"\\\n]
+STRING			  ({NAME}|\"{L_NO_DQUOTES}{1,80}\")
+ESTRING			  (\"{L_NO_DQUOTES}{81}|\"\")
 DISK			  disk
 INTERN			  internal|\"internal\"
-META_IDX		  {LS}*\[{LS}*{NUM}{LS}*\]
-O_IDX			  {WSC}meta-index{ASSIGN}
-IGNORE			  {WSC}
-SKIP			  skip({LS}[^{\n]*)?
-NDELIM			  [^ \t\n#;{}]+
-_1_254			  [1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]
-_0_255			  0|[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-5]
+META_IDX		  {LS}?\[{LS}?{NUM}{LS}?\]
+O_IDX			  {WS}meta-index{ASSIGN}
+IGNORE			  {WS}
+SKIP			  skip({LS}[^{\n]{0,80})?
+NDELIM			  [^ \t\n#;{}]{1,50}
+_1_254			  [1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-4]
+_0_255			  0|[1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]
 IPV4ADDR		  {_1_254}\.{_0_255}\.{_0_255}\.{_1_254}
-PORT			  {WSC}port{ASSIGN}{NUM}
+PORT			  {WS}port{ASSIGN}{NUM}
 
 %%
 
@@ -81,9 +73,16 @@
   {SKIP}		section(IGNORE_SECTION);
 }
 
+<INITIAL,ASSIGN,LBRACE,META_IDX,RESOURCE,GLOBAL,STARTUP,DISK,NET,SYNCER,HOST,PORT>{
+  {COMMENT_START}	{
+  				char c;
+				while ((c = input()) != '\n' && c != EOF);
+				if (c == '\n') ++line;
+			}
+}
+
 <INITIAL>{
-  {COMMENT}		/* discard last comment if no eol at eof */
-  {WSC}			update_lcnt();
+  {WS}			update_lcnt();
   global		section(GLOBAL); return TK_GLOBAL;
   resource		named_section(RESOURCE); return TK_RESOURCE;
   \}			syntax_error("unmached closing brace.");
@@ -96,8 +95,9 @@
 }
 
 <NAME>{
+  {ENAME}		syntax_error("name too long.\n");
   {NAME}		yy_pop_state(); CP; return TK_STRING;
-  [^ \t\n#]+		expect_error("name"); /* not referenced currently */
+  [^ \t\n#]{1,80}	expect_error("name"); /* not referenced currently */
 }
 
 <SEMICOLON>{
@@ -110,7 +110,7 @@
 <ASSIGN>{
   {ASSIGN}		yy_pop_state(); fline = line;
   =			syntax_error("don't use '=' signs anymore!");
-  {WSC}			syntax_error("linebreak between option and value not allowed.\n");
+  {WS}			syntax_error("linebreak between option and value not allowed.\n");
   {NDELIM}		expect_error("whitespace");
 }
 
@@ -132,8 +132,9 @@
 }
 
 <STRING>{
+  {ENAME}		syntax_error("name too long.\n");
+  {ESTRING}		syntax_error("string terminator missing or string too long.\n");
   {STRING}		yy_pop_state(); unescape(); CP; return TK_STRING;
-  {USTRING}		syntax_error("string terminator missing.\n");
   {NDELIM}		expect_error("string"); yy_pop_state();
 }
 
@@ -145,7 +146,8 @@
 
 <PORT>{
   :			BEGIN(NUM); /* this is only reached when I have a colon */
-  {WSC}port{ASSIGN}	{
+  {WS}			update_lcnt();
+  port{ASSIGN}		{
 			  /* or a 'port = ' following the 'address = ' */
 			  update_lcnt(); BEGIN(NUM);
 			  PRINTF("'port=<port>' deprecated, "
@@ -154,16 +156,17 @@
 }
 
 <IP_AND_PORT>{
+  {LS}			/* ignore */
+  \"			syntax_error("please do not quote IP:PORT.\n");
   {IPV4ADDR}/:{NUM}	BEGIN(PORT); CP; return TK_IPADDR;
   {IPV4ADDR}/{PORT}	BEGIN(PORT); CP; return TK_IPADDR;
   {IPV4ADDR}		syntax_error("':PORT' missing from IP:PORT.\n");
-  \"{IPV4ADDR}[^ \t\n]+	syntax_error("please do not quote IP:PORT.\n");
-  [0-9.:]+		expect_error("valid IP");
   {NDELIM}		expect_error("IP and port 'XXX.XXX.XXX.XXX:PORT'");
 }
 
 <META_IDX>{
   {META_IDX}		unescape_midx(); yy_pop_state(); CP; return TK_INTEGER;
+  {WS}			update_lcnt();
   {O_IDX}		{
 			  update_lcnt(); BEGIN(NUM);
 			  PRINTF("'meta-index=<idx>' deprecated, "
@@ -175,9 +178,10 @@
   {INTERN}		unescape(); yy_pop_state();  CP; return TK_STRING;
   {INTERN}{META_IDX}	|
   {INTERN}{O_IDX}	syntax_error("don't give an index for internal meta-data.");
+  {ESTRING}		syntax_error("string terminator missing or string too long.\n");
   {STRING}/{META_IDX}	|
   {STRING}/{O_IDX}{NUM} unescape(); BEGIN(META_IDX); CP; return TK_STRING;
-  {STRING}{LS}*{NDELIM}	expect_error("meta-disk: index missing; either 'internal' or '/dev/ice/name [index]'");
+  {STRING}{LS}?{NDELIM}	expect_error("meta-disk: index missing; either 'internal' or '/dev/ice/name [index]'");
   {NDELIM}		expect_error("either 'internal' or '/dev/ice/name [index]'");
 }
 
@@ -187,12 +191,13 @@
 }
 
 <LBRACE>{
-  {WSC}*\{{WSC}*	update_lcnt(); yy_pop_state();
-  {WSC}*[^{ \t\n]+	expect_error("'{'");
+  {WS}			update_lcnt();
+  \{			update_lcnt(); yy_pop_state();
+  [^{ \t\n]{1,40}	expect_error("'{'");
 }
 
 <IGNORE_SECTION>{
-  [^{}]+		update_lcnt(); /* no ECHO */
+  [^{}]			update_lcnt(); /* no ECHO */
   \{			yy_push_state(IGNORE_SECTION);
 }
 



More information about the drbd-cvs mailing list