[GRASS-git] [OSGeo/grass] 4c7db5: i.group: fit long names to fancy file listing (#1818)

nilason noreply at github.com
Thu Aug 26 07:52:22 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 4c7db5b21580063fffbccc696106bc00db174f00
      https://github.com/OSGeo/grass/commit/4c7db5b21580063fffbccc696106bc00db174f00
  Author: nilason <n_larsson at yahoo.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M include/grass/defs/imagery.h
    M lib/imagery/list_gp.c
    M lib/imagery/list_subgp.c

  Log Message:
  -----------
  i.group: fit long names to fancy file listing (#1818)

Addresses failure to list files with long names and
-Wformat-overflow= warnings.

There are two ways to list files in a group with i.group, a fancy one
with -l and a raw one with -lg. The fancy one is limited to a 80
character column, with angle bracket format: <mapname at mapset>. Before
this commit, if this "fancy" formatted string would exceed 80 char,
then buffer overflow occurs. With this commit, in the rare (theoretical)
occasion with very long mapname and/or mapset, they may be truncated
if needed (to fit in 80 chars).

Example of truncation in case of long map name:

ifonlythisisalandsatfilewithaveryverylongnameandagainifonlythisisalandsatfilewithaveryverylongnamePERMANENT

becomes:
<ifonlythisisalandsatfilewithaveryverylongnameandagainifonly... at PERMANENT>




More information about the grass-commit mailing list