Index | Thread | Search

From:
Nir Lichtman <nir@lichtman.org>
Subject:
Re: Fix incorrect default editor path in GDB
To:
Theo Buehler <tb@theobuehler.org>
Cc:
tech@openbsd.org, pascal@openbsd.org
Date:
Fri, 20 Sep 2024 09:31:32 +0000

Download raw body.

Thread
  • Theo Buehler:

    Fix incorrect default editor path in GDB

  • On Fri, Sep 20, 2024 at 11:04:02AM +0200, Theo Buehler wrote:
    > Thanks. I'm ok with committing this.
    > 
    > If we do commit this, we should probably add the following to ports gdb.
    > It's annoying that it needs three patches. I suppose either nobody is
    > using gdb's edit command or those who do all have EDITOR set...
    > 
    > I don't think this needs to make 7.6 release (I'd say setting EDITOR is
    > an acceptable workaround for something that's been broken since forever),
    > so I plan on committing this after ports unlock.
    > 
    > Index: Makefile
    > ===================================================================
    > RCS file: /cvs/ports/devel/gdb/Makefile,v
    > diff -u -p -r1.84 Makefile
    > --- Makefile	28 May 2024 16:48:39 -0000	1.84
    > +++ Makefile	20 Sep 2024 08:59:36 -0000
    > @@ -2,7 +2,7 @@ COMMENT=	GNU debugger
    >  CATEGORIES=	devel
    >  
    >  DISTNAME=	gdb-9.2
    > -REVISION=	6
    > +REVISION=	7
    >  
    >  HOMEPAGE=	https://www.gnu.org/software/gdb/
    >  
    > Index: patches/patch-gdb_cli_cli-cmds_c
    > ===================================================================
    > RCS file: patches/patch-gdb_cli_cli-cmds_c
    > diff -N patches/patch-gdb_cli_cli-cmds_c
    > --- /dev/null	1 Jan 1970 00:00:00 -0000
    > +++ patches/patch-gdb_cli_cli-cmds_c	20 Sep 2024 08:57:48 -0000
    > @@ -0,0 +1,12 @@
    > +Index: gdb/cli/cli-cmds.c
    > +--- gdb/cli/cli-cmds.c.orig
    > ++++ gdb/cli/cli-cmds.c
    > +@@ -956,7 +956,7 @@ edit_command (const char *arg, int from_tty)
    > +     }
    > + 
    > +   if ((editor = getenv ("EDITOR")) == NULL)
    > +-    editor = "/bin/ex";
    > ++    editor = "/usr/bin/ex";
    > + 
    > +   fn = symtab_to_fullname (sal.symtab);
    > + 
    > Index: patches/patch-gdb_doc_gdb_info-2
    > ===================================================================
    > RCS file: patches/patch-gdb_doc_gdb_info-2
    > diff -N patches/patch-gdb_doc_gdb_info-2
    > --- /dev/null	1 Jan 1970 00:00:00 -0000
    > +++ patches/patch-gdb_doc_gdb_info-2	20 Sep 2024 08:57:41 -0000
    > @@ -0,0 +1,12 @@
    > +Index: gdb/doc/gdb.info-2
    > +--- gdb/doc/gdb.info-2.orig
    > ++++ gdb/doc/gdb.info-2
    > +@@ -626,7 +626,7 @@ parts of the program:
    > + --------------------------
    > + 
    > + You can customize GDB to use any editor you want (1).  By default, it is
    > +-'/bin/ex', but you can change this by setting the environment variable
    > ++'/usr/bin/ex', but you can change this by setting the environment variable
    > + 'EDITOR' before using GDB.  For example, to configure GDB to use the
    > + 'vi' editor, you could use these commands with the 'sh' shell:
    > +      EDITOR=/usr/bin/vi
    > Index: patches/patch-gdb_doc_gdb_texinfo
    > ===================================================================
    > RCS file: patches/patch-gdb_doc_gdb_texinfo
    > diff -N patches/patch-gdb_doc_gdb_texinfo
    > --- /dev/null	1 Jan 1970 00:00:00 -0000
    > +++ patches/patch-gdb_doc_gdb_texinfo	20 Sep 2024 08:57:43 -0000
    > @@ -0,0 +1,12 @@
    > +Index: gdb/doc/gdb.texinfo
    > +--- gdb/doc/gdb.texinfo.orig
    > ++++ gdb/doc/gdb.texinfo
    > +@@ -36,7 +36,7 @@
    > + @set EDITION Tenth
    > + 
    > + @c !!set GDB edit command default editor
    > +-@set EDITOR /bin/ex
    > ++@set EDITOR /usr/bin/ex
    > + 
    > + @c THIS MANUAL REQUIRES TEXINFO 4.0 OR LATER.
    > + 
    
    An alternative solution could be to have the installation add a symlink from /bin/ex to /usr/bin/ex, this could save patching GDB which indeed looks to have until today /bin/ex hardcoded in the codebase.
    It looks to be a pretty standard path across unix likes.
    
    I can work on a patch for the alternative solution if it sounds better
    
    Thanks,
    
    
    
  • Theo Buehler:

    Fix incorrect default editor path in GDB