Bug 183438

Summary: devel/gindent: gindent "-linux" option causes program exit
Product: Ports & Packages Reporter: Wietse Venema <wietse>
Component: Individual Port(s)Assignee: Johan van Selst <johans>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.txt none

Description Wietse Venema 2013-10-29 13:10:00 UTC
gindent is a cross-platform code formatter for C-like program source code.

The *BSD port of the GNU indent command (FreeBSD gindent-2.2.10_2 port) errors out when the '-linux' command-line option is specified.

This is a symptom of a larger problem: someone tweaked a dozen or so of gindent's documented default settings, breaking existing documented behavior,  without even updating the gindent manpage.

See for example: http://www.monkey.org/openbsd/archive/ports/0208/msg00247.html

Fix: Don't break existing gindent features when adding a "new" profile such as "knf". Update a manpage when you change a program's default settings. Especially with cross-platform programs that people rely on to work consistently.

Patch attached with submission follows:
How-To-Repeat: Without the -linux option, no error:

$ echo '' | /usr/local/bin/gindent
$

With the -linux option, error:

$ echo '' | /usr/local/bin/gindent -linux
command line: option ``-il1'' requires a numeric parameter
$

The -linux option breaks because the lower-level "il1" option is broken. I have not investigated what other options may be affected.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-11-03 22:15:11 UTC
Responsible Changed
From-To: freebsd-ports-bugs->johans

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2013-11-04 07:30:42 UTC
Author: johans
Date: Mon Nov  4 07:30:34 2013
New Revision: 332669
URL: http://svnweb.freebsd.org/changeset/ports/332669

Log:
  - Fix parsing of the -il option
  - Enable STAGE support
  
  PR:		ports/183438
  Submitted by:	Wietse Venema <wietse@porcupine.org>

Deleted:
  head/devel/gindent/files/patch-ab
Modified:
  head/devel/gindent/Makefile
  head/devel/gindent/files/patch-args.c
  head/devel/gindent/files/patch-doc:Makefile.in
  head/devel/gindent/files/patch-indent.h
  head/devel/gindent/pkg-plist

Modified: head/devel/gindent/Makefile
==============================================================================
--- head/devel/gindent/Makefile	Mon Nov  4 06:05:12 2013	(r332668)
+++ head/devel/gindent/Makefile	Mon Nov  4 07:30:34 2013	(r332669)
@@ -3,7 +3,7 @@
 
 PORTNAME=	gindent
 PORTVERSION=	2.2.10
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	devel
 MASTER_SITES=	${MASTER_SITE_GNU}
 MASTER_SITE_SUBDIR=	indent
@@ -18,7 +18,6 @@ LDFLAGS+=	-L${LOCALBASE}/lib
 CONFIGURE_ARGS=	--program-prefix=g
 MAKE_JOBS_UNSAFE=	yes
 
-NO_STAGE=	yes
 .include <bsd.port.options.mk>
 
 .if ${PORT_OPTIONS:MNLS}
@@ -29,7 +28,6 @@ CONFIGURE_ARGS+=--disable-nls
 PLIST_SUB+=	NLS="@comment "
 .endif
 
-MAN1=		gindent.1
 INFO=		indent
 
 .include <bsd.port.pre.mk>
@@ -39,9 +37,9 @@ post-patch:
 		's|malloc\.h|stdlib.h|g'
 
 post-install:
-.if !defined(NOPORTDOCS)
-	@${MKDIR} ${DOCSDIR}
-	${INSTALL_DATA} ${WRKSRC}/doc/indent.html ${DOCSDIR}
+.if ${PORT_OPTIONS:MDOCS}
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/doc/indent.html ${STAGEDIR}${DOCSDIR}
 .endif
 
 .include <bsd.port.post.mk>

Modified: head/devel/gindent/files/patch-args.c
==============================================================================
--- head/devel/gindent/files/patch-args.c	Mon Nov  4 06:05:12 2013	(r332668)
+++ head/devel/gindent/files/patch-args.c	Mon Nov  4 07:30:34 2013	(r332669)
@@ -1,6 +1,6 @@
 --- src/args.c.orig	2008-03-11 19:50:42.000000000 +0100
-+++ src/args.c	2010-06-27 16:29:54.000000000 +0200
-@@ -163,6 +163,7 @@
++++ src/args.c	2013-11-04 07:16:35.000000000 +0100
+@@ -163,6 +163,7 @@ static int exp_hnl  = 0;
  static int exp_i    = 0;
  static int exp_il   = 0;
  static int exp_ip   = 0;
@@ -8,7 +8,7 @@
  static int exp_kr   = 0;
  static int exp_l    = 0;
  static int exp_lc   = 0;
-@@ -237,6 +238,30 @@
+@@ -237,6 +238,30 @@ typedef struct
  
  static void usage (void); 
  
@@ -39,7 +39,7 @@
  #ifdef BERKELEY_DEFAULTS
  
  /**
-@@ -264,63 +289,66 @@
+@@ -264,63 +289,66 @@ const pro_ty pro[] =
  #endif
      {"pi",      PRO_INT,                               -1, ONOFF_NA, &settings.paren_indent,                     &exp_pi},
      {"pcs",     PRO_BOOL,                           false,       ON, &settings.proc_calls_space,                 &exp_pcs},
@@ -113,8 +113,8 @@
 +/* This is now the default. */
 +    KNF_PRO_SETTINGS,
 +    {"ip",      PRO_INT,                                8, ONOFF_NA, &settings.indent_parameters,                &exp_ip},
-+    {"i",       PRO_INT,                                8, ONOFF_NA, &settings.ind_size,                         &exp_i},
      {"il",      PRO_INT,             DEFAULT_LABEL_INDENT, ONOFF_NA, &settings.label_offset,                     &exp_il},
++    {"i",       PRO_INT,                                8, ONOFF_NA, &settings.ind_size,                         &exp_i},
      {"hnl",     PRO_BOOL,                            true,       ON, &settings.honour_newlines,                  &exp_hnl},
      {"h",       PRO_FUNCTION,                           0, ONOFF_NA, (int *) usage,                              &exp_version},
 -    {"gnu",     PRO_SETTINGS,                           0, ONOFF_NA, GNU_SETTINGS_STRING,                        &exp_gnu},
@@ -133,7 +133,7 @@
      {"cp",      PRO_INT,                               33, ONOFF_NA, &settings.else_endif_col,                   &exp_cp},
      {"cli",     PRO_INT,                                0, ONOFF_NA, &settings.case_indent,                      &exp_cli},
      {"ci",      PRO_INT,                                4, ONOFF_NA, &settings.continuation_indent,              &exp_ci},
-@@ -341,12 +369,12 @@
+@@ -341,12 +369,12 @@ const pro_ty pro[] =
      {"bl",      PRO_BOOL,                            true,      OFF, &settings.btype_2,                          &exp_bl},
      {"bfda",    PRO_BOOL,                           false,       ON, &settings.break_function_decl_args,         &exp_bfda},
      {"bfde",    PRO_BOOL,                           false,       ON, &settings.break_function_decl_args_end,     &exp_bfde},
@@ -150,7 +150,7 @@
      {"bacc",    PRO_BOOL,                           false,       ON, &settings.blanklines_around_conditional_compilation, &exp_bacc},
      {"T",       PRO_KEY,                                0, ONOFF_NA, 0,                                          &exp_T},
      {"ppi",     PRO_INT,                                0, ONOFF_NA, &settings.force_preproc_width,              &exp_ppi},
-@@ -381,7 +409,7 @@
+@@ -381,7 +409,7 @@ const pro_ty pro[] =
  #endif
      {"pi",      PRO_INT,                               -1, ONOFF_NA, &settings.paren_indent,                     &exp_pi},
      {"pcs",     PRO_BOOL,                            true,       ON, &settings.proc_calls_space,                 &exp_pcs},
@@ -159,7 +159,7 @@
      {"o",       PRO_BOOL,                           false,       ON, &settings.expect_output_file,               &exp_o},
      {"nv",      PRO_BOOL,                           false,      OFF, &settings.verbose,                          &exp_v},
      {"nut",     PRO_BOOL,                            true,      OFF, &settings.use_tabs,                         &exp_ut},
-@@ -425,14 +453,15 @@
+@@ -425,14 +453,15 @@ const pro_ty pro[] =
      {"lp",      PRO_BOOL,                            true,       ON, &settings.lineup_to_parens,                 &exp_lp},
      {"lc",      PRO_INT,     DEFAULT_RIGHT_COMMENT_MARGIN, ONOFF_NA, &settings.comment_max_col,                  &exp_lc},
      {"l",       PRO_INT,             DEFAULT_RIGHT_MARGIN, ONOFF_NA, &settings.max_col,                          &exp_l},
@@ -177,7 +177,7 @@
      {"fca",     PRO_BOOL,                           false,       ON, &settings.format_comments,                  &exp_fca},
      {"fc1",     PRO_BOOL,                           false,       ON, &settings.format_col1_comments,             &exp_fc1},
      {"eei",     PRO_BOOL,                           false,       ON, &settings.extra_expression_indent,          &exp_eei},
-@@ -593,6 +622,9 @@
+@@ -593,6 +622,9 @@ const long_option_conversion_ty option_c
      {"blank-lines-after-declarations",              "bad"},
      {"blank-lines-after-commas",                    "bc"},
      {"blank-before-sizeof",                         "bs"},
@@ -187,7 +187,7 @@
      {"berkeley-style",                              "orig"},
      {"berkeley",                                    "orig"},
      {"Bill-Shannon",                                "bs"},
-@@ -798,7 +830,7 @@
+@@ -798,7 +830,7 @@ extern int set_option(
  
      if (!found)
      {

Modified: head/devel/gindent/files/patch-doc:Makefile.in
==============================================================================
--- head/devel/gindent/files/patch-doc:Makefile.in	Mon Nov  4 06:05:12 2013	(r332668)
+++ head/devel/gindent/files/patch-doc:Makefile.in	Mon Nov  4 07:30:34 2013	(r332669)
@@ -1,6 +1,6 @@
 --- doc/Makefile.in.orig	2008-03-11 19:54:15.000000000 +0100
-+++ doc/Makefile.in	2010-06-27 16:29:17.000000000 +0200
-@@ -602,10 +602,10 @@
++++ doc/Makefile.in	2013-11-04 06:57:00.000000000 +0100
+@@ -602,10 +602,10 @@ uninstall-am: uninstall-dvi-am uninstall
  	uninstall-pdf-am uninstall-ps-am
  
  

Modified: head/devel/gindent/files/patch-indent.h
==============================================================================
--- head/devel/gindent/files/patch-indent.h	Mon Nov  4 06:05:12 2013	(r332668)
+++ head/devel/gindent/files/patch-indent.h	Mon Nov  4 07:30:34 2013	(r332669)
@@ -1,6 +1,6 @@
 --- src/indent.h.orig	2008-03-11 19:50:42.000000000 +0100
-+++ src/indent.h	2010-06-27 16:29:17.000000000 +0200
-@@ -135,9 +135,9 @@
++++ src/indent.h	2013-11-04 06:57:00.000000000 +0100
+@@ -135,9 +135,9 @@ typedef enum bb_code
    bb_cast
  } bb_code_ty;
  

Modified: head/devel/gindent/pkg-plist
==============================================================================
--- head/devel/gindent/pkg-plist	Mon Nov  4 06:05:12 2013	(r332668)
+++ head/devel/gindent/pkg-plist	Mon Nov  4 07:30:34 2013	(r332669)
@@ -1,5 +1,6 @@
 bin/gindent
 bin/gtexinfo2man
+man/man1/gindent.1.gz
 %%PORTDOCS%%%%DOCSDIR%%/indent.html
 %%NLS%%share/locale/ca/LC_MESSAGES/indent.mo
 %%NLS%%share/locale/da/LC_MESSAGES/indent.mo
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Johan van Selst freebsd_committer freebsd_triage 2013-11-04 08:10:37 UTC
State Changed
From-To: open->closed

Fixed. Thanks for the report. 
For the record, this is a bug in the standard GNU indent source. 
It is an issue whenever -DBERKELEY_DEFAULTS is set and has nothing 
to do with FreeBSD-specific additions.