From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24321 invoked from network); 4 Dec 2023 08:02:06 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Dec 2023 08:02:06 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1701676926; b=Jkt2GVFbSHW0S2Oz6emcVF5ltQcXLwOWXdECBqWuoyV5Q7mCLt0iOH6Ij9p09PFpsztXl+aHA/ H7Wbs2JJ0IpFsRQcKGt4YOhSNopgtm23DZKT7519SrfAUen4/6XAzItFns6tT3K7bM1MbbKcUO OppexUOsP8rz355Z2tAwWiKdNsINyl/ucXF+ydnGTdcJPpnMY++j3E5i5zzSoHibZdRZv2Wcx1 agPWvzfuWuFHKRbeU8+Ly2LbOUKFEbkbWygJTU9RWvi6fcSqqRPak5jsecvWlAcN+DYcQcatu9 LxzTut0eRi6Wps4B1QkVcHwdbt/VOkAumlRyiTIeSPUSJw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (hekla.abc.se) smtp.remote-ip=158.174.61.227; dkim=pass header.d=abc.se header.s=default header.a=rsa-sha256; dmarc=none header.from=abc.se; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1701676926; bh=0Q4OM0f/1g0YsRrgzLixKgW+eRa8CW5UWnjgzvgOXRs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature; b=P+QlG40IlUpMhYRZ4enYvp/igG5SKrZX71aYpGai8PFpHoUROB64jwzDAWiM8W7/pAKU7um3am gt9Pg+Wnzjk7yczm5FdS3BN1EDIBKOyt44vC7k/L9ETqh1BYe4BIsCTwwAMVVnKihbErnmaMjC dJLlZzFHE6Gef1i2voLCfKOjwP8f/431zVyuiZZmw939vg/8WhckW743//MSpOmyW5mLvKqRRn dYd0qHpMwo+R+C4GcN++fvtT4YQo+j/FKsncUIIpO9G7xGW0OqexNZPlJwkf3vNstOrWE85bSx ak3j7lUz+q+uJwb8G5duOk4o8OLPI0hEPS0xvFlsSWSWZQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=qwLnpsFLZxXSerrzD+uYKj6Cdp0ZE87ghZ37UQIQZq8=; b=rh/U7TrWe+DmdtDeLz/V3UG2LF pVmY8Abdw8rEswCL35OEg0yozbdCkiK4wg/r0v3z9bxWhuCrG+xv0uGQ0iafkEEa0WpvVXht6cSs3 L7eY4ncof4fFyVbEz67460c8GaaMxRx8PV3PhHVzFTl2Nm182Bpeocd9WJrJ3y6n45EZnL130Irb3 zcpkSN/KImt+p1jilCrA2nkyzvGIdIQaE5AAyxQEqkzRlPi37Tq1UA4fPPAhCW5Fupz+IkXlv2syU EyDvNksgRNMEFAl9kdHG8g4kIp8q7Li0pVzFVwLqR6jg7Cwpc4Fmf4cBq8AiUZmNYz1rb9y/g5lH6 A29eHW/Q==; Received: by zero.zsh.org with local id 1rA3u1-000AWI-S8; Mon, 04 Dec 2023 08:02:05 +0000 Authentication-Results: zsh.org; iprev=pass (hekla.abc.se) smtp.remote-ip=158.174.61.227; dkim=pass header.d=abc.se header.s=default header.a=rsa-sha256; dmarc=none header.from=abc.se; arc=none Received: from hekla.abc.se ([158.174.61.227]:6227) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rA3tQ-000AD6-M4; Mon, 04 Dec 2023 08:01:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=default; bh=qwLnpsFLZx XSerrzD+uYKj6Cdp0ZE87ghZ37UQIQZq8=; h=in-reply-to:references:subject: cc:to:from:date; d=abc.se; b=RRpXoH8ixKNzrV/VJgFzny3t+8kirNcw/gLYc4M56 YW5QBjzGIGkVUax/nQ4t7ANX7Ev02mq42+i5MXGNQ9Y3kiP/9FeBK6lZqNGh37cdsghBtq fUlBzdz+FqhUSm9NnDM7pDNQlkohGrmidWO0tqPwq29PcPgrsWDgOVE2H5Z9LRM9ZHMGuY 4JfMEW2W87QxcfzBDONaZF8wu02P0JK3Yexpfc7q6TklEVn5/TUmqZzq4QS3KACL2To3OC Fgy15X42VOLX2vasCsd6iyllwcMuVKg24vTdm1IyVqAWFcZWJjaXtDLEQAyFokBrcTkb8e LrBuj+hkILnpUdzVys70g== Received: from harpo.local (94-255-132-157.cust.bredband2.com [94.255.132.157]) by hekla.abc.se (OpenSMTPD) with ESMTPSA id 5f5d0bfa (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 Dec 2023 09:01:27 +0100 (CET) Date: Mon, 4 Dec 2023 09:01:25 +0100 From: Andreas =?iso-8859-1?B?S+Ro5HJp?= To: "Wang, Yichao" Cc: "zsh-workers@zsh.org" Subject: Re: A bug on cat command for zsh Message-ID: Mail-Followup-To: "Wang, Yichao" , "zsh-workers@zsh.org" References: <8C290B6D-2952-4CDC-9A90-64E990E25E38@wustl.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8C290B6D-2952-4CDC-9A90-64E990E25E38@wustl.edu> X-Seq: 52369 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Mon, Dec 04, 2023 at 07:01:42AM +0000, Wang, Yichao wrote: > Hi there, > > I am using zsh 5.9 (x86_64-apple-darwin23.0) on MacOS. > > The following command in zsh will cause severe damage by running forever into a dead loop. > - when you accidentally mess up the redirection flows > > ```bash > touch 1.txt > echo "anything" > 1.txt > cat < 1.txt >> 1.txt > ``` > > However, on Linux bash, this behavior is prohibited and hinted. > > ```bash > cat < 1.txt >> 1.txt > cat: -: input file is output file > ``` > > Best, > Unknown name Allowing the programmer to shoot themselves in the foot does not seem like a bug to me. Note that bash release 5.2.15 does not seem to babysit the user in the way that you describe by default. Rather, it's the coreutils implementation of cat that does this. You may have two implementaions of cat on your system (it's possibly a BSD system, or at least non-GNU system, with coreutils installed alongside the native utilities). Check with "type cat" in both shells to see what cat is being picked up. -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .