NetBSD Problem Report #41758

From www@NetBSD.org  Tue Jul 21 18:41:41 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 1EEB763BBD1
	for <gnats-bugs@gnats.netbsd.org>; Tue, 21 Jul 2009 18:41:41 +0000 (UTC)
Message-Id: <20090721184140.E383463B898@www.NetBSD.org>
Date: Tue, 21 Jul 2009 18:41:40 +0000 (UTC)
From: ekamperi@gmail.com
Reply-To: ekamperi@gmail.com
To: gnats-bugs@NetBSD.org
Subject: at(1): print more user friendly message when empty jobs file is given
X-Send-Pr-Version: www-1.0

>Number:         41758
>Category:       bin
>Synopsis:       at(1): print more user friendly message when empty jobs file is given
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 21 18:45:00 +0000 2009
>Last-Modified:  Sat Feb 20 01:50:01 +0000 2010
>Originator:     Stathis Kamperis
>Release:        NetBSD 5.0_STABLE
>Organization:
Aristotle University of Thessaloniki
>Environment:
[stathis@voyager ~] uname -a
NetBSD voyager 5.0_STABLE NetBSD 5.0_STABLE (MYGENERIC) #8: Mon Jul  6 19:55:40 EEST 2009  root@voyager:/usr/obj/sys/arch/i386/compile/MYGENERIC i386

>Description:
[stathis@voyager ~] touch at.jobs 
[stathis@voyager ~] at -f at.jobs 22:00
at: Input error
[stathis@voyager ~] 

It could as well say... "The jobs file is empty" or so.
>How-To-Repeat:

>Fix:
Change the message in usr.bin/at/at.c:390 ?

>Audit-Trail:
From: Christopher Berardi <cberardi@natoufa.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/41758
Date: Fri, 19 Feb 2010 20:47:20 -0500

 This patch makes it so that if it is a file that is in error, it says so. It should be noted that this patch (nor the PR) addresses an issue that even if the file (or stdin) is empty of commands, if there is a space or newline or similar type characters, it will still go through.



 --- at.c.orig	2010-02-19 20:24:31.000000000 -0500
 +++ at.c	2010-02-19 20:30:57.000000000 -0500
 @@ -88,6 +88,7 @@
  char *atinput = NULL;		/* where to get input from */
  unsigned char atqueue = 0;	/* which queue to examine for jobs (atq) */
  char atverify = 0;		/* verify time instead of queuing job */
 +int is_file = 0;		/* is the input coming from file or stdin */

  /* Function declarations */

 @@ -386,8 +387,12 @@
  	    "\t exit 1\n"
  	    "}\n");

 -	if ((ch = getchar()) == EOF)
 -		panic("Input error");
 +	if ((ch = getchar()) == EOF) {
 +		if (is_file)
 +			panic("Input file is empty");
 +		else
 +			panic("Input error");
 +	}

  	do {
  		(void)fputc(ch, fp);
 @@ -617,6 +622,7 @@

  		case 'f':
  			atinput = optarg;
 +			is_file = 1;
  			break;

  		case 'q':	/* specify queue */



 -- 
 Christopher Berardi
 http://www.natoufa.com/

 Be still, and know that I am God (Psalms 46:10)

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.