Your message dated Sun, 13 Nov 2005 12:57:08 -0500
with message-id <[EMAIL PROTECTED]>
and subject line realpath in shellutils
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at maintonly) by bugs.debian.org; 6 Oct 2001 13:11:39 +0000
>From [EMAIL PROTECTED] Sat Oct 06 08:11:39 2001
Return-path: <[EMAIL PROTECTED]>
Received: from isr5624.urh.uiuc.edu [130.126.210.110] 
        by master.debian.org with esmtp (Exim 3.12 1 (Debian))
        id 15prEw-00058t-00; Sat, 06 Oct 2001 08:11:39 -0500
Received: by isr5624.urh.uiuc.edu (Postfix, from userid 1000)
        id 3897113DA9; Sat,  6 Oct 2001 08:11:30 -0500 (CDT)
Date: Sat, 6 Oct 2001 08:11:30 -0500
From: Steven Barker <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: shellutils: new utility: realpath
Message-ID: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="LQksG6bCIzRHxTLp"
Content-Disposition: inline
User-Agent: Mutt/1.3.22i
X-Reportbug-Version: 1.29
X-Debbugs-CC: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]


--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Package: shellutils
Version: 2.0.11-11
Severity: wishlist
Tags: patch

I just wrote a new utility for GNU shell-utils.  I've sent it to the
upstream maintainers at <[email protected]> already, but thought I'd
put it here also.  Since Debian is a fairly homogenous environment (as in,
it always uses glibc) there are fewer portability concerns than might delay
things upstream.

The new utility is realpath.  It finds a canonical path to a given filename.
The canonical path is absolute and contains no symlinks, /./ or /../
references.  It's not quite a definative way to identify a file as hard
links can cause ther to be multiple valid canonical paths to the same file.

I'm attaching the source file realpath.c and a patch to the documentation in
sh-utils.texi .  I don't understand autoconf well enough to add the file to
the build, but it should work with the same commands as most of the other
utilities.

There is an implementation of realpath in the dwww package already in
Debian.  I didn't realize this until I was mostly done with my version, but
it seems to me that shell-utils is the proper place for this program.  If
realpath gets added to shellutils, I'll ask the dwww maintainer to remove
his version (he should be CCed this bug report).

-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux isr5624 2.4.10 #1 Thu Oct 4 22:43:27 CDT 2001 i686
Locale: LANG=en_US, LC_CTYPE=en_US

Versions of packages shellutils depends on:
ii  libc6                         2.2.4-3    GNU C Library: Shared libraries an
ii  login                         20000902-7 System login tools

-- 
Steven Barker                                      [EMAIL PROTECTED]
  For the next hour, WE will control all that you see and hear.
GnuPG public key: http://www.students.uiuc.edu/~scbarker/pubkey.asc
Fingerprint: 272A 3EC8 52CE F22B F745  775E 5292 F743 EBD5 936B

--LQksG6bCIzRHxTLp
Content-Type: text/x-csrc; charset=us-ascii
Content-Disposition: attachment; filename="realpath.c"

/* realpath - return the canonicalized absolute pathname
   Copyright (C) 2001 Steven Barker

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

/* Written by Steven Barker. */

#include <config.h>
#include <stdio.h>
#include <sys/types.h>

/* this should be changed to use a generic realpath
   function if libc does not have one of its own */
#include <stdlib.h>
#include <limits.h>

#include "system.h"
#include "long-options.h"
#include "error.h"
#include "closeout.h"

/* The official name of this program (e.g., no `g' prefix).  */
#define PROGRAM_NAME "realpath"

#define AUTHORS "Steven Barker"

/* The name this program was run with. */
char *program_name;

void
usage (int status)
{
  if (status != 0)
    fprintf (stderr, _("Try `%s --help' for more information.\n"),
             program_name);
  else
    {
      printf (_("\
Usage: %s PATH\n\
  or:  %s OPTION\n\
"),
              program_name, program_name);
      printf (_("\
Print PATH with all references to `.', `..', and symlinks resolved.\n\
\n\
  --help      display this help and exit\n\
  --version   output version information and exit\n\
"));
      puts (_("\nReport bugs to <[email protected]>."));
    }
  exit (status);
}

int
main (int argc, char **argv)
{
  char *result;
  long int path_max;

  program_name = argv[0];
  setlocale (LC_ALL, "");
  bindtextdomain (PACKAGE, LOCALEDIR);
  textdomain (PACKAGE);

  atexit (close_stdout);

  parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      AUTHORS, usage);
  /* The above handles --help and --version.
     Since there is no other invocation of getopt, handle `--' here.  */
  if (argc > 1 && STREQ (argv[1], "--"))
    {
      --argc;
      ++argv;
    }

  if (argc != 2)
    {
      error (0, 0, argc < 2 ? _("too few arguments")
             : _("too many arguments"));
      usage (1);
    }

#ifdef PATH_MAX
  path_max = PATH_MAX;
#else
  path_max = pathconf (name, _PC_PATH_MAX);
  if (path_max <= 0)
    path_max = 4096;
#endif

  result = malloc(path_max);
   
  if(! realpath (argv[1], result))
    {
      free(result);
      error(1, errno, argv[1]);
    }

  printf ("%s\n", result);

  free(result);

  exit (0);
}

--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="shellutils.texi.diff"

diff -u shellutils-2.0.11/doc/sh-utils.texi 
shellutils-withrealpath/doc/sh-utils.texi
--- shellutils-2.0.11/doc/sh-utils.texi Wed Oct 18 15:42:43 2000
+++ shellutils/doc/sh-utils.texi        Sat Oct  6 06:23:42 2001
@@ -44,6 +44,7 @@
 * printenv: (sh-utils)printenv invocation.      Print environment variables.
 * printf: (sh-utils)printf invocation.          Format and print data.
 * pwd: (sh-utils)pwd invocation.                Print working directory.
+* realpath: (sh-utils)realpath invocation.      Print canonicalized path name.
 * seq: (sh-utils)seq invocation.                Print numeric sequences
 * sleep: (sh-utils)sleep invocation.            Delay for a specified time.
 * stty: (sh-utils)stty invocation.              Print/change terminal settings.
@@ -131,7 +132,7 @@
 * Printing text::               echo printf yes
 * Conditions::                  false true test expr
 * Redirection::                 tee
-* File name manipulation::      dirname basename pathchk
+* File name manipulation::      dirname basename realpath pathchk
 * Working context::             pwd stty printenv tty
 * User information::            id logname whoami groups users who
 * System context::              date uname hostname
@@ -1045,6 +1046,7 @@
 @menu
 * basename invocation::         Strip directory and suffix from a file name.
 * dirname invocation::          Strip non-directory suffix from a file name.
+* realpath invocation::         Print canonical path to a file.
 * pathchk invocation::          Check file name portability.
 @end menu
 
@@ -1091,6 +1093,27 @@
 
 If @var{name} is a single component, @code{dirname} prints @samp{.}
 (meaning the current directory).
+
+The only options are @samp{--help} and @samp{--version}.  @xref{Common
+options}.
+
+
[EMAIL PROTECTED] realpath invocation
[EMAIL PROTECTED] @code{realpath}: Print canonicalized path to a file.
+
[EMAIL PROTECTED] realpath
[EMAIL PROTECTED] file names, canonicalizing
[EMAIL PROTECTED] canonical file names, finding
[EMAIL PROTECTED] symlinks, expanding
+
[EMAIL PROTECTED] finds the canonical path to a file.  Synopsis:
+
[EMAIL PROTECTED]
+realpath @var{name}
[EMAIL PROTECTED] example
+
[EMAIL PROTECTED] expands all symbolic links and resolves references to
[EMAIL PROTECTED]/./} and @samp{/../} and extra @samp{/} characters in 
@var{name}.
 
 The only options are @samp{--help} and @samp{--version}.  @xref{Common
 options}.

--LQksG6bCIzRHxTLp--

---------------------------------------
Received: (at 114659-done) by bugs.debian.org; 13 Nov 2005 17:57:10 +0000
>From [EMAIL PROTECTED] Sun Nov 13 09:57:10 2005
Return-path: <[EMAIL PROTECTED]>
Received: from vms042pub.verizon.net ([206.46.252.42])
        by spohr.debian.org with esmtp (Exim 4.50)
        id 1EbM6I-0007Yq-1v
        for [EMAIL PROTECTED]; Sun, 13 Nov 2005 09:57:10 -0800
Received: from osgiliath.mathom.us ([70.108.64.202])
 by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep
 9 2005)) with ESMTPA id <[EMAIL PROTECTED]> for
 [EMAIL PROTECTED]; Sun, 13 Nov 2005 11:57:09 -0600 (CST)
Received: from localhost (localhost [127.0.0.1])
        by osgiliath.mathom.us (Postfix) with ESMTP id D98466031E0      for
 <[EMAIL PROTECTED]>; Sun, 13 Nov 2005 12:57:08 -0500 (EST)
Received: from osgiliath.mathom.us ([127.0.0.1])
        by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024)
        with LMTP id 19682-01-2 for <[EMAIL PROTECTED]>; Sun,
 13 Nov 2005 12:57:08 -0500 (EST)
Received: by osgiliath.mathom.us (Postfix, from userid 1000)
        id BE36360049B; Sun, 13 Nov 2005 12:57:08 -0500 (EST)
Date: Sun, 13 Nov 2005 12:57:08 -0500
From: Michael Stone <[EMAIL PROTECTED]>
Subject: realpath in shellutils
To: [EMAIL PROTECTED]
Message-id: <[EMAIL PROTECTED]>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii; format=flowed
Content-disposition: inline
X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C  84 52 84 C5 EE DF 7C 88
X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us
User-Agent: Mutt/1.5.11
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Level: 
X-Spam-Status: No, hits=-2.0 required=4.0 tests=BAYES_01 autolearn=no 
        version=2.60-bugs.debian.org_2005_01_02

coreutils has included realpath for some time now.

Mike Stone


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to