search for: shell_quote

Displaying 20 results from an estimated 56 matches for "shell_quote".

Did you mean: shell_unquote
2009 Jul 27
2
[PATCH] Replace shell_quote function with %Q and %R printf specifiers.
At the moment the daemon code contains an incredibly hairy function called shell_quote for safely quoting strings passed to the shell. The patch replaces that with a glibc custom printf format (actually two, but very closely related), %Q and %R. %Q is like %s but it safely shell quotes the string. %R is like %Q but it prefixes the path with /sysroot. Example usage (w/o error chec...
2020 Jul 10
0
[RFC nbdkit PATCH] server: Allow --run with --vsock
...4 --- a/server/captive.c +++ b/server/captive.c @@ -72,7 +72,7 @@ run_command (void) /* Construct $uri. */ fprintf (fp, "uri="); if (port) { - fprintf (fp, "nbd://localhost:"); + fprintf (fp, vsock ? "nbd+vsock://1:" : "nbd://localhost:"); shell_quote (port, fp); if (strcmp (exportname, "") != 0) { putc ('/', fp); @@ -99,29 +99,31 @@ run_command (void) * different syntax, so try to guess which one we need. */ fprintf (fp, "nbd="); - if (strstr (run, "guestfish")) { - if (port) { -...
2009 Jul 28
1
[PATCH v2] Replace shell_quote function with %Q and %R printf specifiers.
Here is an update to the patch posted yesterday. The changes are: (1) Don't use inline (for mdbooth). (2) Added a comment to HACKING (for mdbooth). (3) Check for old-style and new-style glibc functions and use whatever is available (for danpb). (4) Removed the old shell_quote function instead of just commenting it out. Can anyone decode from Uli's message[1] whether these new functions are going to be added to POSIX 2008? It's not very clear to me. Rich. [1] http://udrepper.livejournal.com/20948.html -- Richard Jones, Emerging Technologies, Red Hat http:/...
2019 Jun 26
3
[nbdkit PATCH v2 0/2] adding nbdkit --run '$uri'
Since v1: - new patch to add uri_quote() - rebase on top of other recent patches needed while auditing shell_quote() - use uri_quote() instead of shell_quote() for producing $uri Eric Blake (2): common/utils: Add uri_quote and tests captive: Support $uri in --run docs/nbdkit-captive.pod | 8 ++- common/utils/utils.h | 1 + common/utils/test-quotes.c | 108 ++++++++++++++++++++++++++++++++++++...
2019 Jun 26
3
[nbdkit PATCH] captive: Support $uri in --run
...+++ b/server/captive.c @@ -66,7 +66,19 @@ run_command (void) exit (EXIT_FAILURE); } - /* Construct $nbd "URL". Unfortunately guestfish and qemu take + /* Construct $uri. */ + fprintf (fp, "uri="); + if (port) { + fprintf (fp, "nbd://localhost:"); + shell_quote (port, fp); + } + else if (unixsocket) { + fprintf (fp, "nbd+unix://\\?socket="); + shell_quote (unixsocket, fp); + } + fprintf (fp, "\n"); + + /* Construct older $nbd "URL". Unfortunately guestfish and qemu take * different syntax, so try to guess whic...
2019 Jun 26
3
[nbdkit PATCH] iso: Shell-quote an alternative isoprog
...ry commands rather than exec()ing them directly. This patch also doesn't resolve the fact that we are also passing params= through shell parsing (if we don't like that, we should consider changing the interface to make the user write param='-V' param='My Disk Image' and use shell_quote() over each param, rather than the current params='-V "My Disk Image"'), but does try to enhance the docs to point it out with more clarity. Signed-off-by: Eric Blake <eblake@redhat.com> --- I'm pushing this now, but we may want to reconsider the iso plugin exposing pa...
2020 Apr 07
2
[PATCH nbdkit v2] tmpdisk: Generalize the tmpdisk plugin
An evolution of v1 here: https://www.redhat.com/archives/libguestfs/2020-April/msg00035.html I want to generalize the tmpdisk plugin, particularly so you can use commands like ‘qemu-img create’ or even ‘virt-builder’. (Actually virt-builder really works - I tested it - but of course it causes a 30+ second delay when connecting to the server.) You can now use commands such as: nbdkit tmpdisk
2019 Feb 19
0
[PATCH nbdkit 3/4] common: Move a utility function to a common directory.
From: "Richard W.M. Jones" <rjones@redhat.com> The shell_quote function is moved to a new common/utils directory. Eventually more utility functions can be created here. This change is pure refactoring. --- Makefile.am | 1 + common/utils/Makefile.am | 41 ++++++++++++++++++++++++++++ common/utils/utils.c | 70 +++++++++++++++++++++++++++++++...
2020 Apr 04
0
[PATCH nbdkit 2/2] tmpdisk: Pass any parameters as shell variables to the command.
...) { @@ -173,21 +198,26 @@ run_command (const char *disk) /* Avoid stdin/stdout leaking (because of nbdkit -s). */ fprintf (fp, "exec </dev/null >/dev/null\n"); - /* Set the shell variables. */ + /* Set the standard shell variables. */ fprintf (fp, "disk="); shell_quote (disk, fp); putc ('\n', fp); - if (label) { - fprintf (fp, "label="); - shell_quote (label, fp); - putc ('\n', fp); - } fprintf (fp, "size=%" PRIi64 "\n", size); - fprintf (fp, "type="); - shell_quote (type, fp); putc (...
2020 Apr 07
0
[PATCH nbdkit v2] tmpdisk: Pass any parameters as shell variables to the command.
...) { @@ -173,21 +202,26 @@ run_command (const char *disk) /* Avoid stdin/stdout leaking (because of nbdkit -s). */ fprintf (fp, "exec </dev/null >/dev/null\n"); - /* Set the shell variables. */ + /* Set the standard shell variables. */ fprintf (fp, "disk="); shell_quote (disk, fp); putc ('\n', fp); - if (label) { - fprintf (fp, "label="); - shell_quote (label, fp); + fprintf (fp, "size=%" PRIi64 "\n", requested_size); + putc ('\n', fp); + + /* The other parameters/shell variables. */ + for (v = vars; v !=...
2010 May 12
1
[PATCH] guestfish -i and virt-inspector work on filenames containing spaces (RHBZ#507810).
...modify * it under the terms of the GNU General Public License as published by @@ -66,6 +66,7 @@ static void cmdline (char *argv[], int optind, int argc); static void initialize_readline (void); static void cleanup_readline (void); static void add_history_line (const char *); +static int print_shell_quote (FILE *stream, const char *str); /* Currently open libguestfs handle. */ guestfs_h *g; @@ -362,9 +363,6 @@ main (int argc, char *argv[]) /* Inspector mode invalidates most of the other arguments. */ if (inspector) { - char cmd[1024]; - int r; - if (drvs || mps || remote_contr...
2020 Apr 08
0
[PATCH nbdkit v3] tmpdisk: Pass any parameters as shell variables to the command.
...) { @@ -173,21 +215,26 @@ run_command (const char *disk) /* Avoid stdin/stdout leaking (because of nbdkit -s). */ fprintf (fp, "exec </dev/null >/dev/null\n"); - /* Set the shell variables. */ + /* Set the standard shell variables. */ fprintf (fp, "disk="); shell_quote (disk, fp); putc ('\n', fp); - if (label) { - fprintf (fp, "label="); - shell_quote (label, fp); + fprintf (fp, "size=%" PRIi64 "\n", requested_size); + putc ('\n', fp); + + /* The other parameters/shell variables. */ + for (v = vars; v !=...
2019 Jun 26
0
Re: [nbdkit PATCH] captive: Support $uri in --run
...n_command (void) > exit (EXIT_FAILURE); > } > > - /* Construct $nbd "URL". Unfortunately guestfish and qemu take > + /* Construct $uri. */ > + fprintf (fp, "uri="); > + if (port) { > + fprintf (fp, "nbd://localhost:"); > + shell_quote (port, fp); > + } > + else if (unixsocket) { > + fprintf (fp, "nbd+unix://\\?socket="); > + shell_quote (unixsocket, fp); > + } > + fprintf (fp, "\n"); > + > + /* Construct older $nbd "URL". Unfortunately guestfish and qemu take >...
2020 Apr 08
2
[PATCH nbdkit v3] tmpdisk: Generalize the tmpdisk plugin.
v2 was here: https://www.redhat.com/archives/libguestfs/2020-April/msg00075.html In v3: - Add [VAR=VALUE ...] to manual. - Various minor improvements to the manual. - Work (at least, in theory - not tested) with block devices or symlinks. I didn't document this because it's hard to ensure these files or block devices would be cleaned up, so here be dragons. - Remove O_NOCTTY. -
2020 Jul 21
0
Re: [PATCH nbdkit] server: Deprecate the -e/--exportname parameter.
...gt; - assert (exportname != NULL); > - > fp = open_memstream (&cmd, &len); > if (fp == NULL) { > perror ("open_memstream"); > @@ -74,27 +72,13 @@ run_command (void) > if (port) { > fprintf (fp, "nbd://localhost:"); > shell_quote (port, fp); > - if (strcmp (exportname, "") != 0) { > - putc ('/', fp); > - uri_quote (exportname, fp); > - } > } > else if (unixsocket) { > - fprintf (fp, "nbd+unix://"); > - if (strcmp (exportname, "") !=...
2020 Apr 04
4
[PATCH nbdkit 0/2] Generalize the tmpdisk plugin.
Patch 1/2 is uncontroversial. Patch 2/2 is an interesting idea I had to generalize this plugin. It already uses a complete embedded shell script to do most of the work. What if, instead of making special cases for "type" and "label" params, we simply turn any other plugin parameters into script variables? This part of it works fine. However there is another problem which is
2020 Mar 17
0
Re: [PATCH nbdkit v2] New tmpdisk plugin.
...+ size_t len = 0; > + int r; > + > + fp = open_memstream (&cmd, &len); > + if (fp == NULL) { > + nbdkit_error ("open_memstream: %m"); > + return -1; > + } > + > + /* Set the shell variables. */ > + fprintf (fp, "disk="); > + shell_quote (disk, fp); [1]...here you are correctly quoting the definition of disk, and...[2] > + putc ('\n', fp); > + if (label) { > + fprintf (fp, "label="); > + shell_quote (label, fp); > + putc ('\n', fp); > + } > + fprintf (fp, "size=%&qu...
2020 Jul 06
2
Re: [PATCH nbdkit 2/2] tar: Rewrite the tar plugin (again), this time in C.
...t;); > + return -1; > + } > + fprintf (fp, "LANG=C tar --no-auto-compress -tRvf "); Use of --no-auto-compress is specific to GNU tar, do we care? Should we allow a 'tar=/path/to/tar' parameter during .config to allow a user to point to an alternative tar? > + shell_quote (tarfile, fp); > + fputc (' ', fp); > + shell_quote (file, fp); > + if (fclose (fp) == EOF) { > + nbdkit_error ("memstream failed: %m"); > + return -1; > + } > + > + /* Run the command and read the first line of the output. */ > + nbdkit_debu...
2020 Jul 06
0
Re: [PATCH nbdkit 2/2] tar: Rewrite the tar plugin (again), this time in C.
...is also not supported by non-GNU tar. > Should we allow a 'tar=/path/to/tar' parameter during .config to > allow a user to point to an alternative tar? Yes, this is a potential enhancement, especially where GNU tar might be called "gtar" (as it is on FreeBSD). > >+ shell_quote (tarfile, fp); > >+ fputc (' ', fp); > >+ shell_quote (file, fp); > >+ if (fclose (fp) == EOF) { > >+ nbdkit_error ("memstream failed: %m"); > >+ return -1; > >+ } > >+ > >+ /* Run the command and read the first line of th...
2020 Jul 21
3
[PATCH nbdkit] server: Deprecate the -e/--exportname parameter.
...@@ run_command (void) if (!run) return; - assert (exportname != NULL); - fp = open_memstream (&cmd, &len); if (fp == NULL) { perror ("open_memstream"); @@ -74,27 +72,13 @@ run_command (void) if (port) { fprintf (fp, "nbd://localhost:"); shell_quote (port, fp); - if (strcmp (exportname, "") != 0) { - putc ('/', fp); - uri_quote (exportname, fp); - } } else if (unixsocket) { - fprintf (fp, "nbd+unix://"); - if (strcmp (exportname, "") != 0) { - putc ('/', fp); -...