diff mbox

[4/4] Default to acting like fsck.

Message ID 1411261282-26831-4-git-send-email-xnox@debian.org (mailing list archive)
State New, archived
Headers show

Commit Message

Dimitri John Ledkov Sept. 21, 2014, 1:01 a.m. UTC
Inspect arguments, if we are not called as btrfs, then assume we are
called to act like fsck.

Bug-Debian: http://bugs.debian.org/712078
Signed-off-by: Dimitri John Ledkov <xnox@debian.org>
---
 btrfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tobias Geerinckx-Rice Sept. 21, 2014, 12:59 p.m. UTC | #1
On 21 September 2014 03:01, Dimitri John Ledkov <xnox@debian.org> wrote:
>
> Inspect arguments, if we are not called as btrfs, then assume we are
> called to act like fsck.
[...]
> -       if (!strcmp(bname, "btrfsck")) {
> +       if (strcmp(bname, "btrfs") != 0) {

That's assuming a lot.

Silently (!) breaking people's btrfs-3.15_patched-DontRandomlyPanicV2
is a recipe for needless hair-pulling. Is there a reason for not using
something less like strstr(bname, "fsck") that I am missing?

Regards,

T G-R
--
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
Dimitri John Ledkov Sept. 22, 2014, 8:58 a.m. UTC | #2
On 21 September 2014 13:59, Tobias Geerinckx-Rice
<tobias.geerinckx.rice@gmail.com> wrote:
> On 21 September 2014 03:01, Dimitri John Ledkov <xnox@debian.org> wrote:
>>
>> Inspect arguments, if we are not called as btrfs, then assume we are
>> called to act like fsck.
> [...]
>> -       if (!strcmp(bname, "btrfsck")) {
>> +       if (strcmp(bname, "btrfs") != 0) {
>
> That's assuming a lot.
>
> Silently (!) breaking people's btrfs-3.15_patched-DontRandomlyPanicV2
> is a recipe for needless hair-pulling. Is there a reason for not using
> something less like strstr(bname, "fsck") that I am missing?
>

Quite. This is verbatim patch as I have currently applied in Debian
packaging, and it was a fast fix to prevent breakage we had at one
point.

Indeed using "strstr(bname, "fsck")" would be better and sufficient to
resolve the problem we encountered (specifically fsck.btrfs -> btrfs
not acting like btrfs). Also using strstr, would fix btrfsck.my-build
to act like fsck tool.

I'll update this one patch.
David Sterba Sept. 22, 2014, 1:13 p.m. UTC | #3
On Mon, Sep 22, 2014 at 09:58:34AM +0100, Dimitri John Ledkov wrote:
> On 21 September 2014 13:59, Tobias Geerinckx-Rice
> <tobias.geerinckx.rice@gmail.com> wrote:
> > On 21 September 2014 03:01, Dimitri John Ledkov <xnox@debian.org> wrote:
> >>
> >> Inspect arguments, if we are not called as btrfs, then assume we are
> >> called to act like fsck.
> > [...]
> >> -       if (!strcmp(bname, "btrfsck")) {
> >> +       if (strcmp(bname, "btrfs") != 0) {
> >
> > That's assuming a lot.
> >
> > Silently (!) breaking people's btrfs-3.15_patched-DontRandomlyPanicV2
> > is a recipe for needless hair-pulling. Is there a reason for not using
> > something less like strstr(bname, "fsck") that I am missing?
> >
> 
> Quite. This is verbatim patch as I have currently applied in Debian
> packaging, and it was a fast fix to prevent breakage we had at one
> point.
> 
> Indeed using "strstr(bname, "fsck")" would be better and sufficient to
> resolve the problem we encountered (specifically fsck.btrfs -> btrfs
> not acting like btrfs). Also using strstr, would fix btrfsck.my-build
> to act like fsck tool.

The intention was to provide backward compatibility shortcut for
'btrfsck' -> 'btrfs check' and nothing else. The referenced bug is again
for 0.19 but there's an upstream-shipped stub fsck.btrfs (since 3.14)
that should avoid any packaging tricks.
--
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
diff mbox

Patch

diff --git a/btrfs.c b/btrfs.c
index e83349c..e8a87ac 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -222,7 +222,7 @@  int main(int argc, char **argv)
 	else
 		bname = argv[0];
 
-	if (!strcmp(bname, "btrfsck")) {
+	if (strcmp(bname, "btrfs") != 0) {
 		argv[0] = "check";
 	} else {
 		argc--;