From: Hin-Tak Leung Subject: Re: [PATCH V2] hfsplus: fixes worst-case unicode to char conversion of file names and attributes Date: Tue, 8 Apr 2014 20:53:14 +0100 (BST) Message-ID: <1396986794.16777.YahooMailBasic@web172304.mail.ir2.yahoo.com> Reply-To: htl10@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, hch@infradead.org To: slava@dubeyko.com, anton@tuxera.com Return-path: Received: from nm7-vm2.bullet.mail.ir2.yahoo.com ([212.82.96.127]:47635 "EHLO nm7-vm2.bullet.mail.ir2.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932663AbaDHTxQ convert rfc822-to-8bit (ORCPT ); Tue, 8 Apr 2014 15:53:16 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: ------------------------------ On Tue, Apr 8, 2014 6:21 PM BST Vyacheslav Dubeyko wrote: > >On Apr 8, 2014, at 9:09 PM, Anton Altaparmakov wrote: > >[snip] > >>=20 >> Unfortunately, it doesn't make sense to have fix only in hfsplus_lis= txattr(). >> It fixes nothing for xattr names. Of course, you can mention name of= the patch. :) >> But such partial fix doesn't make sense for me. It will be more clea= r way to have >> one patch for file names and another patch for xattr names. >>=20 >> You are entitled to your opinion but I agree with Hin-Tak.=A0 This m= akes perfect sense as it fixes the use of a function which can otherwis= e cause an erroneous EIO error to be returned from listxattr().=A0 This= in itself is a worthwhile fix.=A0 Your idea of having to fix everythin= g or nothing at all is frankly quite silly and would mean that hardly a= nything ever gets fixed...=A0 Fixing small problems individually is jus= t fine, especially when they are such obvious ones. >>=20 > >I have another opinion. :) But, of course, it is possible to see on th= ings in >different ways. I don't think that topic of splitting fixes between pa= tches >is really important. But my suggestion has more logical basis. > >But, anyway, I suggest to use kmem cache for the case of xattr names >instead of kmalloc. This patch fix usages of hfsplus_uni2asc(). There are only two. I think we all agree that there is a lot more work to be done in the at= tribute side to make sure that getting and setting long non-english attributes to work. And there will= be a series of patches to it. The discussion is really on how this is split. There are two uses of HFSPLUS_MAX_STRLEN concern asc2uni(), and are correct where they are. There is one other use in super.c:319: buf->f_namelen =3D HFSPLUS_MAX_STRLEN; That may need some thinking. It is probably correct. =46or HFSPLUS_ATTR_MAX_STRLEN, besides the one I changed, there are 9 o= ther uses as size of buffers (and a similar number in checks for length over-run,= etc). As I wrote earlier, some of these are setters, rather than getters. Set= ters and getters are different. The setters probably should use a large enough buffer ac= cording to userland, (ie. not a file-system specific one), and let the lower-la= yer of the file system returns an error when one is trying to set a too-long attribute. The ge= tters needs to cope with what listxttr() returns. So I see there should be at least two forth-coming patches related to a= ttributes. One can bundle the attribute part of the current patch to the latter; b= ut then that's assuming that the getter part of these further patches is logically one. It may = be complex enough to require splitting up. We have 9 buffers, divisible at least n= ow into two groups, getters and setters - it might need to be divided further. There are OS= -prefixes complications along the way, so we may end up having to do 3-4 addition= al patches. At this point it is not obvious that half of the current patch should b= e deferred, and where/what it should defer to. So I am thinking just "com= mit early, commit often". Retrospectively - when we look back on it afterwards, in a few month's = time -, the whole set of work will form a patch series; but one advantage of *n= ot* declaring a patch series, is that it allows others to work on it. e.g. It may be = important for Sergei to put his name down on one of these further patches, if claimin= g a change under his/her name is an important issue :-). 85+ CJK characters for file names isn't too uncommon. I have non-englis= h file names on my hard disk with say, 50+ characters. If you insist on doing Chinese all the way, 127/3 =3D 42 is really a bi= t low for a descriptive string of any usage, but does anybody use non-english exten= ded attributes on any OSes? Hin-Tak =20 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html