NetBSD Problem Report #44312
From www@NetBSD.org Sun Jan 2 19:07:08 2011
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 1192263B89F
for <gnats-bugs@gnats.NetBSD.org>; Sun, 2 Jan 2011 19:07:08 +0000 (UTC)
Message-Id: <20110102190707.E5BAA63B87A@www.NetBSD.org>
Date: Sun, 2 Jan 2011 19:07:07 +0000 (UTC)
From: loganaden@devio.us
Reply-To: loganaden@devio.us
To: gnats-bugs@NetBSD.org
Subject: dired patches for portable mg
X-Send-Pr-Version: www-1.0
>Number: 44312
>Category: pkg
>Synopsis: dired patches for portable mg
>Confidential: no
>Severity: non-critical
>Priority: high
>Responsible: abs
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jan 02 19:10:00 +0000 2011
>Closed-Date: Mon Apr 21 20:53:11 +0000 2014
>Last-Modified: Mon Apr 21 20:53:11 +0000 2014
>Originator: Loganaden (Logan) Velvindron
>Release: 5.1 with pkgsrc from -current
>Organization:
Wandering Ninja
>Environment:
NetBSD 5.1 NetBSD 5.1 (GENERIC) #7: Sun Jan 2 17:10:14 MUST 2011 root@:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
portable mg lacks dired patches that I worked on for openbsd's mg.
It makes a couple of sanity checks, and aligns the pointer on the file name which is much less annoying and is closer to Emacs dired.
See kjell's commit:
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mg/dired.c.diff?r1=1.45;r2=1.46
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mg/file.c.diff?r1=1.71;r2=1.72
>How-To-Repeat:
None
>Fix:
$NetBSD: patch-aa,v 1.1.1.1 2009/02/13 11:04:14 abs Exp $
--- dired.c.orig 2011-01-02 18:02:33.000000000 +0000
+++ dired.c
@@ -570,11 +570,11 @@ d_makename(struct line *lp, char *fn, si
ep = lp->l_text + llength(lp);
p++; /* skip action letter, if any */
for (i = 0; i < NAME_FIELD; i++) {
- while (p < ep && isspace(*p))
+ while (p < ep && isspace((unsigned char)*p))
p++;
- while (p < ep && !isspace(*p))
+ while (p < ep && !isspace((unsigned char)*p))
p++;
- while (p < ep && isspace(*p))
+ while (p < ep && isspace((unsigned char)*p))
p++;
if (p == ep)
return (ABORT);
@@ -593,8 +593,14 @@ dired_(char *dname)
struct buffer *bp;
FILE *dirpipe;
char line[256];
- int len, ret;
+ int len, ret, counter, warp;
+ counter = warp = 0;
+ if ((fopen(dname,"r")) == NULL) {
+ if (errno == EACCES)
+ ewprintf("Permission denied");
+ return (NULL);
+ }
if ((dname = adjustname(dname, FALSE)) == NULL) {
ewprintf("Bad directory name");
return (NULL);
@@ -642,13 +648,26 @@ dired_(char *dname)
while (fgets(&line[2], sizeof(line) - 2, dirpipe) != NULL) {
line[strcspn(line, "\n")] = '\0'; /* remove ^J */
(void) addline(bp, line);
+ if ((strrchr(line, ' ')) != NULL) {
+ counter++;
+ if ((strcmp((strrchr(line, ' ')), " ..")) == 0)
+ warp = counter;
+ }
+ }
+ if ((strrchr(line, ' ')) != NULL) {
+ if (strcmp((strrchr(line, ' ')), " ..") == 0)
+ warp = counter - 1;
}
+ if ((strrchr(line, ' ')) != NULL)
+ bp->b_doto = strrchr(line, ' ') - line + 1;
if (pclose(dirpipe) == -1) {
ewprintf("Problem closing pipe to ls : %s",
strerror(errno));
return (NULL);
}
bp->b_dotp = bfirstlp(bp);
+ while (warp--)
+ bp->b_dotp = lforw(bp->b_dotp);
(void)strlcpy(bp->b_fname, dname, sizeof(bp->b_fname));
(void)strlcpy(bp->b_cwd, dname, sizeof(bp->b_cwd));
if ((bp->b_modes[1] = name_mode("dired")) == NULL) {
$NetBSD$
--- file.c.orig 2011-01-02 18:02:39.000000000 +0000
+++ file.c
@@ -219,10 +219,12 @@ readin(char *fname)
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
if (wp->w_bufp == curbp) {
- wp->w_dotp = wp->w_linep = bfirstlp(curbp);
- wp->w_doto = 0;
- wp->w_markp = NULL;
- wp->w_marko = 0;
+ if ((fisdir(fname)) != TRUE) {
+ wp->w_dotp = wp->w_linep = bfirstlp(curbp);
+ wp->w_doto = 0;
+ wp->w_markp = NULL;
+ wp->w_marko = 0;
+ }
}
}
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->abs
Responsible-Changed-By: gls@NetBSD.org
Responsible-Changed-When: Mon, 03 Jan 2011 19:18:56 +0000
Responsible-Changed-Why:
Over to maintainer.
From: loganaden@devio.us (Loganaden Velvindron)
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/44312 (dired patches for portable mg)
Date: Tue, 4 Jan 2011 15:12:15 -0500 (EST)
thanks gls !
//Logan
C-x-C-c
State-Changed-From-To: open->closed
State-Changed-By: abs@NetBSD.org
State-Changed-When: Mon, 21 Apr 2014 20:53:11 +0000
State-Changed-Why:
package had been updated to newer version.
>Unformatted:
(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.