Bug 162050 - [patch] misc/lv directory opening problem fix
Summary: [patch] misc/lv directory opening problem fix
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Munechika Sumikawa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-27 09:10 UTC by Iwao Koichiro
Modified: 2012-08-23 10:00 UTC (History)
1 user (show)

See Also:


Attachments
lv.patch (1.32 KB, patch)
2011-10-27 09:10 UTC, Iwao Koichiro
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Iwao Koichiro 2011-10-27 09:10:09 UTC
  misc/lv tries viewing directories by force.

Fix: See an attached patch.

How-To-Repeat:   See differences between `less /` and `lv /`.
  I don't know whether author made to behave like this on purpose, 
  anyway my patch makes lv to behave more less-like.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-10-27 09:10:20 UTC
Responsible Changed
From-To: freebsd-ports-bugs->sumikawa

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Munechika Sumikawa freebsd_committer freebsd_triage 2011-11-06 14:34:26 UTC
State Changed
From-To: open->feedback

Hi, 

This patch seems not FreeBSD specific.  Could you contact to the 
original author of lv to merge your patch? 

-- Sumikawa 

http://www.freebsd.org/cgi/query-pr.cgi?pr=162050 

Date: Sun, 06 Nov 2011 23:32:34 +0900 (JST)
Comment 3 Philip M. Gollucci freebsd_committer freebsd_triage 2012-02-22 05:10:24 UTC
State Changed
From-To: feedback->closed

submitter timeout (Koichiro IWAO <meta@club.kyutech.ac.jp> ; 107 days)
Comment 4 dfilter service freebsd_committer freebsd_triage 2012-08-23 09:59:42 UTC
Author: sumikawa
Date: Thu Aug 23 08:59:30 2012
New Revision: 302983
URL: http://svn.freebsd.org/changeset/ports/302983

Log:
  Show error when opening a directory'.  It's the same behavior with less.
  
  PR:		162050
  Submitted by:	Koichiro IWAO <meta@club.kyutech.ac.jp>

Added:
  head/misc/lv/files/patch-src_lv.c   (contents, props changed)
Modified:
  head/misc/lv/Makefile

Modified: head/misc/lv/Makefile
==============================================================================
--- head/misc/lv/Makefile	Thu Aug 23 08:36:42 2012	(r302982)
+++ head/misc/lv/Makefile	Thu Aug 23 08:59:30 2012	(r302983)
@@ -7,7 +7,7 @@
 
 PORTNAME=	lv
 PORTVERSION=	4.51
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	misc
 MASTER_SITES=	http://www.ff.iij4u.or.jp/~nrt/freeware/
 DISTNAME=	lv451

Added: head/misc/lv/files/patch-src_lv.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/lv/files/patch-src_lv.c	Thu Aug 23 08:59:30 2012	(r302983)
@@ -0,0 +1,49 @@
+--- lv.c.orig	2004-01-05 16:30:15.000000000 +0900
++++ lv.c	2012-08-23 16:49:46.728726453 +0900
+@@ -2,6 +2,7 @@
+  * lv.c
+  *
+  * All rights reserved. Copyright (C) 1996 by NARITA Tomio.
++ * Copyright (C) Oct 27, 2011 Koichiro IWAO. All rights reserved.
+  * $Id: lv.c,v 1.10 2004/01/05 07:30:15 nrt Exp $
+  */
+ /*
+@@ -89,16 +90,35 @@
+     grep_mode = FALSE;
+ }
+ 
++private boolean_t isDirectory(byte **file) {
++  struct stat buf;
++  stat((unsigned char *)file, &buf);
++  if (S_ISDIR(buf.st_mode)) {
++    fprintf(stderr, "%s is a directory\n", file);
++    return TRUE;
++  } else {
++    return FALSE;
++  }
++}
++
+ private boolean_t LvOpen( conf_t *conf )
+ {
++  boolean_t flagIsDirectory = FALSE;
++
+   if( NULL != conf->file ){
++    if( TRUE == isDirectory( *conf->file ) ){
++      flagIsDirectory = TRUE;
++    }
+     if( NULL == (conf->st = StreamOpen( *conf->file )) ){
+       while( NULL != *(++conf->file) ){
+-	if( NULL != (conf->st = StreamOpen( *conf->file )) )
+-	  return TRUE;
++	if( NULL != (conf->st = StreamOpen( *conf->file )) ){
++          if( TRUE == isDirectory( *conf->file ) ){
++            flagIsDirectory = TRUE;
++	  }
++	}
+       }
+-      return FALSE;
+     }
++    return (TRUE == flagIsDirectory ? FALSE : TRUE);
+   } else {
+     conf->st = StreamReconnectStdin();
+   }
_______________________________________________
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"