linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Noah Massey <noah.massey@gmail.com>
To: Evan Danaher <github@edanaher.net>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs-progs: send-dump: always print a space after path
Date: Tue, 11 Apr 2017 09:24:56 -0400	[thread overview]
Message-ID: <CADfjVrg793+_eb21OpX0ps5Fat6a=2SxED87meuMabXQjSyT=A@mail.gmail.com> (raw)
In-Reply-To: <20170411000904.GF2455@edanaher.net>

On Mon, Apr 10, 2017 at 8:09 PM, Evan Danaher <github@edanaher.net> wrote:
> I was shocked to discover that 'btrfs receive --dump' doesn't print a
> space after long filenames, so it runs together into the metadata; for
> example:
>
> truncate        ./20-00-03/this-name-is-32-characters-longsize=0
>
> This is a trivial patch to add a single space unconditionally, so the
> result is the following:
>
> truncate        ./20-00-03/this-name-is-32-characters-long size=0
>
> I suppose this is technically a breaking change, but it seems unlikely
> to me that anyone would depend on the existing behavior given how
> unfriendly it is.
>
>
> Signed-off-by: Evan Danaher <github@edanaher.net>
> ---
> diff --git a/send-dump.c b/send-dump.c
> index 67f7977..493389f 100644
> --- a/send-dump.c
> +++ b/send-dump.c
> @@ -116,9 +116,10 @@ static int __print_dump(int subvol, void *user, const char *path,
>                 putchar('\n');
>                 return 0;
>         }
> -       /* Short paths ale aligned to 32 chars */
> -       while (ret++ < 32)
> +       /* Short paths are aligned to 32 chars; longer paths get a single space */
> +       do {
>                 putchar(' ');
> +       } while (ret++ < 32);

while (++ret < 32);

Since we're performing the check after the put, we need to
pre-increment to count the space already added.

>         va_start(args, fmt);
>         /* Operation specified ones */
>         vprintf(fmt, args);
> ---
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-04-11 13:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11  0:09 [PATCH] btrfs-progs: send-dump: always print a space after path Evan Danaher
2017-04-11 13:24 ` Noah Massey [this message]
2017-04-11 13:49   ` Evan Danaher
2017-04-19 17:23     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADfjVrg793+_eb21OpX0ps5Fat6a=2SxED87meuMabXQjSyT=A@mail.gmail.com' \
    --to=noah.massey@gmail.com \
    --cc=github@edanaher.net \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).