From unknown Wed Sep 10 22:20:33 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#29205 <29205@debbugs.gnu.org> To: bug#29205 <29205@debbugs.gnu.org> Subject: Status: --force doesn't work Reply-To: bug#29205 <29205@debbugs.gnu.org> Date: Thu, 11 Sep 2025 05:20:33 +0000 retitle 29205 --force doesn't work reassign 29205 coreutils submitter 29205 Konstantin Kharlamov severity 29205 normal tag 29205 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 08 04:35:55 2017 Received: (at submit) by debbugs.gnu.org; 8 Nov 2017 09:35:55 +0000 Received: from localhost ([127.0.0.1]:57585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCMm3-0005sy-Jq for submit@debbugs.gnu.org; Wed, 08 Nov 2017 04:35:55 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44973) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCMm1-0005sj-V7 for submit@debbugs.gnu.org; Wed, 08 Nov 2017 04:35:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCMlw-0000tI-4o for submit@debbugs.gnu.org; Wed, 08 Nov 2017 04:35:48 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:56306) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCMlw-0000tE-0r for submit@debbugs.gnu.org; Wed, 08 Nov 2017 04:35:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCMlv-0005eN-1C for bug-coreutils@gnu.org; Wed, 08 Nov 2017 04:35:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCMlp-0000pS-0P for bug-coreutils@gnu.org; Wed, 08 Nov 2017 04:35:47 -0500 Received: from forward104j.mail.yandex.net ([5.45.198.247]:34225) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCMlo-0000p6-Kn for bug-coreutils@gnu.org; Wed, 08 Nov 2017 04:35:40 -0500 Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 7E18B42B32 for ; Wed, 8 Nov 2017 12:35:33 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id cSRnRTrmCT-ZXxGK7PO; Wed, 08 Nov 2017 12:35:33 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1510133733; bh=jZV8SFxQw4mc9CpW8ggVCHF8ystECPKW7+ds9xEdtKY=; h=To:From:Subject:Message-ID:Date; b=U6EsDX5GevBAXNR1HA+hd5oEqfheLDlXaE0/ES0wwU/JzGuh7T9FQIzuuVFL0nnj4 Yas4WgidYsZ19pB10Rq3qzQ54sPqBaXnYpYLz2eY5AmfFbMkayBSySSPYoNG0C42fV iSNntSOtPrwuhQxD2ZCOjYiRMqUnMcrUtBU5nRRU= Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id KBHflIO4bQ-ZWh8cKnJ; Wed, 08 Nov 2017 12:35:32 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1510133732; bh=jZV8SFxQw4mc9CpW8ggVCHF8ystECPKW7+ds9xEdtKY=; h=To:From:Subject:Message-ID:Date; b=gxFCpewneH/dG2X9Bf0B4HUAifImVjQjjj0ISrE3DH4ZVXYDXfL7L1MdyLByS9q6c 7R7ClhLVV4Lz3NOHXYqWvvCTkhIvAflWdR67BkQk0AGDuu0uOdmoRfq1Gku3Awc6oB NL3dealpClvGbDoNX3+3EhJnE82r1C7utzLDxsVY= Authentication-Results: smtp3o.mail.yandex.net; dkim=pass header.i=@yandex.ru To: bug-coreutils@gnu.org From: Konstantin Kharlamov Subject: --force doesn't work Message-ID: <86a3d5f0-935f-aeae-e8ed-1b935b83f402@yandex.ru> Date: Wed, 8 Nov 2017 12:35:32 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Steps to reproduce: 1. $ mkdir -p foo/bar/buzz1 2. $ mkdir -p bar/buzz2 3. $ mv --force bar foo/ Expected result: "bar" is merged into the other "bar" Actual result: error "mv: cannot move 'bar' to 'foo/bar': Directory not=20 empty" I am experiencing this the second time on this week, it's a real=20 problem. I'm building a package from a source code, but then it fails=20 because it's another buggy app, so I'm doing "mv=20 /tmp/yaourt-blahblha/package-name ~/Projects" set out to see if I can=20 fix the code, and send patches. But then "mv" fails, because Archlinux's `makepkg` is in its turn buggy,=20 and leaves bad permissions on `pkg` dir inside the code. So I'm removing this dir, and trying to continue `mv`ing, and here we=20 coming to the bug I'm reporting. Of course I could just copy, but `mv`ing is =CE=B1) much faster, and =CE=B2= )=20 leaves dates of file creation in places, so I don't need to rebuild the=20 whole thing over again, only the files I gonna change. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 29 22:01:25 2018 Received: (at 29205) by debbugs.gnu.org; 30 Oct 2018 02:01:25 +0000 Received: from localhost ([127.0.0.1]:52513 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHJLR-00004s-54 for submit@debbugs.gnu.org; Mon, 29 Oct 2018 22:01:25 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHJLO-0008Q7-TJ; Mon, 29 Oct 2018 22:01:23 -0400 Received: by mail-pf1-f194.google.com with SMTP id r64-v6so4955585pfb.13; Mon, 29 Oct 2018 19:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=Dgh453hh2+Bf7pP49ikCemIqSav86hX8AFY/qxdKX1E=; b=F09vYuRkcVvM2Ii6age4Qt5gYO4Jf0bpoPhS7V8hgI5mlTaOyBsK33XAndPonZV+WB KvoGhJRHwscDKB91Atlek4LvVMEBjQqG4CPg5HyZBcLPBsKcQ/NThaPFN/mg48EVu6kF RZUajxRN4zr13IJUV0G7/CB2xfRtdKrL0YXKhpO5TcHrBhjVo0SJsq7llbdmVBwoY9CO 0Q4EoI1R3JiY8GNHgSTGVZUE3dkkf1Joy8y8aVmGMcJmBmi7q+22fBdrWnEkQOdfK0lu jDTN0EyiiYWgLM4TBQQg67fo0XCo6t3o82myQNfHH8K4Tu4C18l3BxQw48v7qkN9qFbQ U5JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Dgh453hh2+Bf7pP49ikCemIqSav86hX8AFY/qxdKX1E=; b=DHm/msTnYTVln4gXOHrEe/+rCSnwjoNk0erLa1R4hkAzcnps+XRLHBHZRTOL7gmhwr lJxJJPZMky088ilv+6GZpuYTDYSAkvW7QzIJ3fvohbfHHQr6i+JPw5tAEUVm0qzV6N7r 7Rq7kE5OT5gJHXA4EyHxb26k4GJpUtVx3K4kFESGZB51EZNvBmX4h1d4hv/Oa3V/dVp8 /qYM/akK1bbc0OjdAzBQ4OzS1pEJRuh8/B2iNk2hAyud+R5fUFJOwWageezbDNPfWbUF gx0oFKNHScGBrg0vDHqxLen8LiaU+Vt7V+lqVtmYLUVAWgx3vUiGybce56WNNObQPsHJ Rwyg== X-Gm-Message-State: AGRZ1gLSL0G3oMMX6pl7BLYVcXrttpxSEfzXUm/WCgtfG8f/sFtYsDI3 VfZNGik29CcwqWt8GlG5Rpp/PHpM+mA= X-Google-Smtp-Source: AJdET5eaQ9T/WG4n4qzcPk/lNyAsO6F7wkMEdW9Tu39AwRCGmAk16aWgFnMcANJYaRfA7iDuAxNvmw== X-Received: by 2002:a63:c448:: with SMTP id m8-v6mr16220681pgg.239.1540864875901; Mon, 29 Oct 2018 19:01:15 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id u15-v6sm414105pgi.71.2018.10.29.19.01.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 19:01:14 -0700 (PDT) Subject: Re: bug#29205: --force doesn't work To: Konstantin Kharlamov , 29205@debbugs.gnu.org References: <86a3d5f0-935f-aeae-e8ed-1b935b83f402@yandex.ru> From: Assaf Gordon Message-ID: <243b70f3-6f46-40b6-c5a9-4465c0dbbd4f@gmail.com> Date: Mon, 29 Oct 2018 20:01:09 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <86a3d5f0-935f-aeae-e8ed-1b935b83f402@yandex.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 29205 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 29205 notabug close 29205 stop (triaging old bugs) It seems your message was lost and not replied to in a year. Sorry about that. On 2017-11-08 2:35 a.m., Konstantin Kharlamov wrote: > Steps to reproduce: > > 1. $ mkdir -p foo/bar/buzz1 > 2. $ mkdir -p bar/buzz2 > 3. $ mv --force bar foo/ > > Expected result: "bar" is merged into the other "bar" > Actual result: error "mv: cannot move 'bar' to 'foo/bar': Directory not > empty" This is the Linux kernel refusing to move (using the rename(2) syscall) source to a non-empty directory: Using 'strace' we can see the sys-call failure: rename("bar", "foo/bar") = -1 ENOTEMPTY (Directory not empty) In the kernel's rename(2) syscall manual page, the error is explained: ENOTEMPTY or EEXIST newpath is a nonempty directory, that is, contains entries other than "." and "..". http://man7.org/linux/man-pages/man2/rename.2.html#ERRORS mv(1) simply forwards the kernel error to the user. > So I'm removing this dir, and trying to continue `mv`ing, and here we > coming to the bug I'm reporting. > > Of course I could just copy, but `mv`ing is α) much faster, and β) > leaves dates of file creation in places, so I don't need to rebuild the > whole thing over again, only the files I gonna change. "cp" will copy all files from inside "bar" to "foo/bar". "mv" tries to replace "foo/bar" with "bar", and because "foo/bar" is not empty, the kernel refuses to replace it. If you care about preserving the fiels inside "bar/", but not the "bar" directory itself, you can use: mv bar/* foo/bar/ Or you can just delete the "foo/bar" directory (using -f ensures it will not complain if the directory doesn't exist): rm -rf ./foo/bar ; mv bar foo As such, I'm closing this bug. Discussion can continue by replying to this thread. -assaf From unknown Wed Sep 10 22:20:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 27 Nov 2018 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator