From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26976 invoked from network); 27 Feb 2009 00:48:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 27 Feb 2009 00:48:30 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 98566 invoked from network); 27 Feb 2009 00:48:24 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 27 Feb 2009 00:48:24 -0000 Received: (qmail 29233 invoked by alias); 27 Feb 2009 00:48:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26618 Received: (qmail 29215 invoked from network); 27 Feb 2009 00:48:19 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 27 Feb 2009 00:48:19 -0000 Received: from mail-bw0-f179.google.com (mail-bw0-f179.google.com [209.85.218.179]) by bifrost.dotsrc.org (Postfix) with ESMTP id DB9668058F83 for ; Fri, 27 Feb 2009 01:48:15 +0100 (CET) Received: by bwz27 with SMTP id 27so811873bwz.45 for ; Thu, 26 Feb 2009 16:48:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=qenOWVUCl4l5TEUdY1PBkhbTm3zxmT4hYGt4KCKAJKo=; b=K8ULUocAWT32a4n3NsUFQL2rwa6q2RADvkel5sgmxbrxHyoSTD6Uj959KyNSV3jbu5 lwTg43hOfRmnrzyRggcFGkY41LDYZOl2V9tRAB7TDry7KjUoSEZhC66HChK44H64Vr11 Czt+OI/DXAxZrZTjlTcaQ7jv7NWYih8XTVnAA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=hqR61IloCRD1Lus9Ad8xWJtF//CO5AfUrodhLpBCne67rQbCk60ppUelBUlWM2sHui 0SGXU074Dk6LdOG87ePYiJlHq5O8gcabhS9Afsp8C5QR4yf1XH5JmtOxwpbx2CxEGlNt p8vRVqBYiU8DV6Ryo00Fqk9y+hq5efSpLAuds= MIME-Version: 1.0 Received: by 10.181.226.19 with SMTP id d19mr656163bkr.35.1235695695634; Thu, 26 Feb 2009 16:48:15 -0800 (PST) In-Reply-To: References: Date: Fri, 27 Feb 2009 01:48:15 +0100 Message-ID: <237967ef0902261648i19f5c5b0jeb54fcd2eb135f92@mail.gmail.com> Subject: Re: [wip patch] new zsh/attr module From: Mikael Magnusson To: zsh workers Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.92.1/9051/Thu Feb 26 14:08:01 2009 on bifrost X-Virus-Status: Clean 2009/2/26 Mikael Magnusson : > Hi, > +static int > +bin_getattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) > +{ > + int ret = 0; > + int len; > + char value[256]; > + > + if (listxattr(*argv, NULL, 0) > 0) { > + if (0 < (len = getxattr(*argv, *(argv+1), value, 255))) { It seems these *argv and the ones below need to be wrapped in unmeta() to work with utf-8 filenames/values. Obviously I can't use unmeta() twice in one function call though, can I call unmetafy() on the argv values or will something be sad then? Can the length grow when I unmetafy so I would need to alloc more space? I also note the cap.c file doesn't unmeta(fy) its arguments so it probably also doesn't work, but I don't have cap stuff so can't test. Also, in unmeta() would putting a break; in the initial loop help? ie for (t = file_name; *t; t++) { if (*t == Meta) { meta = 1; + break; } } (or I suppose you could have *t && !meta) My impression from looking at the code is that only metafy()ing can grow the string, so it should be safe to just unmetafy() the strings, assuming nothing breaks from me modifying the argv strings? -- Mikael Magnusson