Re: [Libguestfs] [PATCH nbdkit 6/9] lib: Use replacement strategy for get_current_dir_name.

Eric Blake
2020-08-18T13:24:30Z

On 8/18/20 5:50 AM, Richard W.M. Jones wrote:
> This is really a replacement for a missing platform function, so use
> the same LIBOBJS mechanism to replace it.
> ---
>   configure.ac                                  |  2 +-
>   common/include/Makefile.am                    |  6 ---
>   common/replacements/Makefile.am               | 10 ++++
>   plugins/floppy/Makefile.am                    |  1 +
>   common/replacements/get_current_dir_name.h    | 49 +++++++++++++++++++
>   server/public.c                               |  2 +-
>   .../get_current_dir_name.c}                   | 10 ++--
>   .../test-current-dir-name.c                   |  2 +-
>   plugins/floppy/virtual-floppy.c               |  2 +-
>   .gitignore                                    |  2 +-
>   10 files changed, 69 insertions(+), 17 deletions(-)

ACK 4-6.

Reminds me of an unrelated question - when a user writes:

nbdkit memory --run './command'

rather than

nbdkit memory --run '/path/to/command'

do we guarantee that the --run snippet will use the current working
directory that nbdkit started under, even though nbdkit itself chdir's
away to / as part of starting the plugin?  (If we do guarantee it, do we
test it? If we haven't yet guaranteed it, should we?)


> +++ b/common/replacements/get_current_dir_name.h
> @@ -0,0 +1,49 @@
> +/* nbdkit
> + * Copyright (C) 2018 Red Hat Inc.
> + * All rights reserved.

2020, lose 'All rights reserved'...

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org