Browse Source

Expand EOF and eof into "end of file" in error messages

Guillem Jover 11 years ago
parent
commit
4531321990

+ 1 - 0
debian/changelog

@@ -85,6 +85,7 @@ dpkg (1.18.0) UNRELEASED; urgency=low
     - Say “execute” instead of “exec” in Dpkg::Changelog::Parse error message.
     - Say “package” instead of “it” in dpkg-name warning message.
     - Uppercase field names in error messages.
+    - Expand EOF and eof into “end of file” in error messages.
 
   [ Raphaël Hertzog ]
   * Drop myself from Uploaders.

+ 10 - 5
dselect/methparse.cc

@@ -153,7 +153,8 @@ void readmethods(const char *pathbase, dselect_option **optionspp, int *nread) {
           badmethod(pathbuf, _("non-digit where digit wanted"));
         vb(c);
         c= fgetc(names);
-        if (c == EOF) eofmethod(pathbuf,names,_("EOF in index string"));
+        if (c == EOF)
+          eofmethod(pathbuf, names, _("end of file in index string"));
       } while (!c_isspace(c));
       if (strlen(vb.string()) > OPTIONINDEXMAXLEN)
         badmethod(pathbuf,_("index string too long"));
@@ -161,7 +162,8 @@ void readmethods(const char *pathbase, dselect_option **optionspp, int *nread) {
       do {
         if (c == '\n') badmethod(pathbuf,_("newline before option name start"));
         c= fgetc(names);
-        if (c == EOF) eofmethod(pathbuf,names,_("EOF before option name start"));
+        if (c == EOF)
+          eofmethod(pathbuf, names, _("end of file before option name start"));
       } while (c_isspace(c));
       vb.reset();
       if (!c_isalpha(c) && c != '_')
@@ -171,20 +173,23 @@ void readmethods(const char *pathbase, dselect_option **optionspp, int *nread) {
           badmethod(pathbuf, _("non-alphanum in option name"));
         vb(c);
         c= fgetc(names);
-        if (c == EOF) eofmethod(pathbuf,names,_("EOF in option name"));
+        if (c == EOF)
+          eofmethod(pathbuf, names, _("end of file in option name"));
       } while (!c_isspace(c));
       opt->name= new char[strlen(vb.string())+1];
       strcpy(opt->name,vb.string());
       do {
         if (c == '\n') badmethod(pathbuf,_("newline before summary"));
         c= fgetc(names);
-        if (c == EOF) eofmethod(pathbuf,names,_("EOF before summary"));
+        if (c == EOF)
+          eofmethod(pathbuf, names, _("end of file before summary"));
       } while (c_isspace(c));
       vb.reset();
       do {
         vb(c);
         c= fgetc(names);
-        if (c == EOF) eofmethod(pathbuf,names,_("EOF in summary - missing newline"));
+        if (c == EOF)
+          eofmethod(pathbuf, names, _("end of file in summary - missing newline"));
       } while (c != '\n');
       opt->summary= new char[strlen(vb.string())+1];
       strcpy(opt->summary,vb.string());

+ 6 - 10
lib/dpkg/parse.c

@@ -636,14 +636,13 @@ parse_stanza(struct parsedb_state *ps, struct field_state *fs,
 
     /* Validate ‘:’. */
     if (parse_EOF(ps))
-      parse_error(ps,
-                  _("EOF after field name `%.*s'"), fs->fieldlen, fs->fieldstart);
+      parse_error(ps, _("end of file after field name '%.*s'"),
+                  fs->fieldlen, fs->fieldstart);
     if (c == '\n')
       parse_error(ps,
                   _("newline in field name `%.*s'"), fs->fieldlen, fs->fieldstart);
     if (c == MSDOS_EOF_CHAR)
-      parse_error(ps,
-                  _("MSDOS EOF (^Z) in field name `%.*s'"),
+      parse_error(ps, _("MSDOS end of file (^Z) in field name '%.*s'"),
                   fs->fieldlen, fs->fieldstart);
     if (c != ':')
       parse_error(ps,
@@ -657,12 +656,10 @@ parse_stanza(struct parsedb_state *ps, struct field_state *fs,
         break;
     }
     if (parse_EOF(ps))
-      parse_error(ps,
-                  _("EOF before value of field `%.*s' (missing final newline)"),
+      parse_error(ps, _("end of file before value of field '%.*s' (missing final newline)"),
                   fs->fieldlen, fs->fieldstart);
     if (c == MSDOS_EOF_CHAR)
-      parse_error(ps,
-                  _("MSDOS EOF char in value of field `%.*s' (missing newline?)"),
+      parse_error(ps, _("MSDOS end of file char in value of field '%.*s' (missing newline?)"),
                   fs->fieldlen, fs->fieldstart);
 
     blank_line = false;
@@ -692,8 +689,7 @@ parse_stanza(struct parsedb_state *ps, struct field_state *fs,
       }
 
       if (parse_EOF(ps))
-        parse_error(ps,
-                    _("EOF during value of field `%.*s' (missing final newline)"),
+        parse_error(ps, _("end of file during value of field '%.*s' (missing final newline)"),
                     fs->fieldlen, fs->fieldstart);
 
       c = parse_getc(ps);

+ 1 - 1
lib/dpkg/utils.c

@@ -49,7 +49,7 @@ fgets_must(char *buf, size_t bufsz, FILE *f, const char *fn)
 	int l = fgets_checked(buf, bufsz, f, fn);
 
 	if (l < 0)
-		ohshit(_("unexpected eof reading `%.250s'"), fn);
+		ohshit(_("unexpected end of file reading '%.250s'"), fn);
 
 	return l;
 }

+ 4 - 3
scripts/Dpkg/Changelog/Debian.pm

@@ -55,7 +55,7 @@ use parent qw(Dpkg::Changelog);
 
 use constant {
     FIRST_HEADING => g_('first heading'),
-    NEXT_OR_EOF => g_('next heading or eof'),
+    NEXT_OR_EOF => g_('next heading or end of file'),
     START_CHANGES => g_('start of change data'),
     CHANGES_OR_TRAILER => g_('more change data or trailer'),
 };
@@ -180,8 +180,9 @@ sub parse {
     }
 
     unless ($expect eq NEXT_OR_EOF) {
-	$self->parse_error($file, $., sprintf(g_('found eof where expected %s'),
-					      $expect));
+        $self->parse_error($file, $.,
+                           sprintf(g_('found end of file where expected %s'),
+                                   $expect));
     }
     unless ($entry->is_empty) {
 	push @{$self->{data}}, $entry;

+ 1 - 1
scripts/Dpkg/Control/HashCore.pm

@@ -238,7 +238,7 @@ sub parse {
 		$_ = <$fh> while defined && m/^\s*$/;
 		unless (length) {
 		    $self->parse_error($desc, g_('expected OpenPGP signature, ' .
-		                                 'found EOF after blank line'));
+		                                 'found end of file after blank line'));
 		}
 		s/\s*\n$//;
 		unless (m/^-----BEGIN PGP SIGNATURE-----$/) {

+ 1 - 1
src/configure.c

@@ -175,7 +175,7 @@ show_prompt(const char *cfgfile, const char *realold, const char *realnew,
 	if (c == EOF) {
 		if (ferror(stdin))
 			ohshite(_("read error on stdin at conffile prompt"));
-		ohshit(_("EOF on stdin at conffile prompt"));
+		ohshit(_("end of file on stdin at conffile prompt"));
 	}
 
 	if (!cc) {

+ 2 - 1
src/main.c

@@ -813,7 +813,8 @@ commandfd(const char *const *argv)
       if (c_isspace(c))
         argc++;
     } while (c != EOF && c != '\n');
-    if (c == EOF) ohshit(_("unexpected eof before end of line %d"),lno);
+    if (c == EOF)
+      ohshit(_("unexpected end of file before end of line %d"), lno);
     if (!argc) continue;
     varbuf_end_str(&linevb);
     newargs = m_realloc(newargs, sizeof(const char *) * (argc + 1));

+ 4 - 2
src/select.c

@@ -148,14 +148,16 @@ setselections(const char *const *argv)
     while (!c_isspace(c)) {
       varbuf_add_char(&namevb, c);
       c= getchar();
-      if (c == EOF) ohshit(_("unexpected eof in package name at line %d"),lno);
+      if (c == EOF)
+        ohshit(_("unexpected end of file in package name at line %d"), lno);
       if (c == '\n') ohshit(_("unexpected end of line in package name at line %d"),lno);
     }
     varbuf_end_str(&namevb);
 
     while (c != EOF && c_isspace(c)) {
       c= getchar();
-      if (c == EOF) ohshit(_("unexpected eof after package name at line %d"),lno);
+      if (c == EOF)
+        ohshit(_("unexpected end of file after package name at line %d"), lno);
       if (c == '\n') ohshit(_("unexpected end of line after package name at line %d"),lno);
     }
 

+ 4 - 2
src/t/dpkg_divert.t

@@ -564,7 +564,8 @@ install_diversions(<<'EOF');
 EOF
 
 call_divert_sort(['--list'], expect_failure => 1,
-            expect_stderr_like => qr/(corrupt|unexpected eof)/, expect_stdout => '');
+                 expect_stderr_like => qr/(corrupt|unexpected end of file)/,
+                 expect_stdout => '');
 
 install_diversions(<<'EOF');
 /bin/sh
@@ -572,7 +573,8 @@ bash
 EOF
 
 call_divert_sort(['--list'], expect_failure => 1,
-            expect_stderr_like => qr/(corrupt|unexpected eof)/, expect_stdout => '');
+                 expect_stderr_like => qr/(corrupt|unexpected end of file)/,
+                 expect_stdout => '');
 
 cleanup();