From owner-freebsd-geom@FreeBSD.ORG Mon Mar 15 20:49:26 2010 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCD321065672 for ; Mon, 15 Mar 2010 20:49:26 +0000 (UTC) (envelope-from gcubfg-freebsd-geom@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id 975F98FC1B for ; Mon, 15 Mar 2010 20:49:26 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1NrHE5-0001HS-Kl for freebsd-geom@freebsd.org; Mon, 15 Mar 2010 21:49:25 +0100 Received: from 93-138-83-214.adsl.net.t-com.hr ([93.138.83.214]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Mar 2010 21:49:25 +0100 Received: from ivoras by 93-138-83-214.adsl.net.t-com.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Mar 2010 21:49:25 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-geom@freebsd.org From: Ivan Voras Date: Mon, 15 Mar 2010 21:49:15 +0100 Lines: 26 Message-ID: References: <20100313083551.GB966@a91-153-117-195.elisa-laajakaista.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 93-138-83-214.adsl.net.t-com.hr User-Agent: Thunderbird 2.0.0.21 (X11/20090612) In-Reply-To: <20100313083551.GB966@a91-153-117-195.elisa-laajakaista.fi> Subject: Re: Escape unsafe characters for kern.geom.confxml XML dump X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 20:49:26 -0000 Jaakko Heinonen wrote: > Hi, > > I intend to commit following patch unless there are objections. I have > seen the problem commonly reported by FreeBSD users. > > --- > > Escape characters unsafe for XML output in GEOM class, instance and provider > names. Go for it! > + for (c = str; *c != '\0'; c++) { > + if (*c == '&' || *c == '<' || *c == '>' || > + *c == '\'' || *c == '"' || *c > 0x7e) > + sbuf_printf(s, "&#x%X;", *c); > + else if (*c == '\t' || *c == '\n' || *c == '\r' || *c > 0x1f) > + sbuf_putc(s, *c); > + else > + sbuf_putc(s, '?'); Wouldn't it be slightly better (it's not important, really), to use HTML "entities" instead - & > < ' " ? The only benefit (which is why it isn't important) is that it would make it more human-readable.