From owner-freebsd-questions@freebsd.org Mon Jul 11 14:41:58 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B51ACB8F492 for ; Mon, 11 Jul 2016 14:41:58 +0000 (UTC) (envelope-from solene@perso.pw) Received: from bsd.zplay.eu (perso.pw [62.210.240.224]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "bsd.zplay.eu", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D65118BD for ; Mon, 11 Jul 2016 14:41:57 +0000 (UTC) (envelope-from solene@perso.pw) Received: from bsd.zplay.eu (localhost [127.0.0.1]) by bsd.zplay.eu (OpenSMTPD) with ESMTP id 25772605 for ; Mon, 11 Jul 2016 16:41:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=perso.pw; h=to:subject :mime-version:content-type:content-transfer-encoding:date:from :message-id; s=selector1; bh=O7N0P8fWXGR1klU1dy2td5LRlM4=; b=BOh 2qsqAXflxbKcJYwvmNP/D7wkwuHL1T7qsk8t3/fiKA+rJX6vMv6AkYkvkm/VoOZa zSTgZ9oaQPYT7AmiEN8DgNUjwt2VQZhy6wZ6I03n0lMnqDDYE+UjyQwGNN5Bpkvx pOKixB1tpKxSzp+kp7P0BX8P4hONITXyS3/T+0N8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=perso.pw; h=to:subject :mime-version:content-type:content-transfer-encoding:date:from :message-id; q=dns; s=selector1; b=B+hc1bYvQjhWBdfpFBrop9SZdKQTX AkdNjD8KMGizs4UqaL2x+U2lIVTyflwKmplbZhW+WIXTjebzBhMpyHC7M9VLVelC zFJ7ShKPktsLnlpAWEmryJHVAmXUnbKs6gncmeHYrmAoBsbM7rmZunUleshX9ThR deN1RXwwvlJ2zY= Received: from localhost (bsd.zplay.eu [local]) by bsd.zplay.eu (OpenSMTPD) with ESMTPA id 12ed5e09 for ; Mon, 11 Jul 2016 16:41:44 +0200 (CEST) To: freebsd-questions@freebsd.org Subject: cp and mv behaviour on a busy binary file X-PHP-Originating-Script: 0:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 11 Jul 2016 16:41:44 +0200 From: =?UTF-8?Q?Sol=C3=A8ne?= Message-ID: X-Sender: solene@perso.pw User-Agent: Roundcube Webmail/1.2.0 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 14:41:58 -0000 Hello, I found a not coherent behaviour when overwriting a busy binary and I would like an explanation on this. When overwriting a busy binary file, without -f flag, cp won't copy the file over the executable while mv will ask if you really want to overwrite it. When using -f, they act the same, the file get overwrited. Example here : shell@example : cat test.c #include int main() { sleep(1000); return 0; } shell@example : clang test.c shell@example : ./a.out & <- I start the executable [1] 83540 shell@example : touch file shell@example : cp file a.out cp: a.out: Text file busy <- cp don't agree shell@example : mv file a.out override rwxr-xr-x solene/solene for a.out? (y/n [n]) y <--- mv asks Kind regards