[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-4.17 v3 07/15] CODING_STYLE(tools/ocaml): add 'make format' and remove tabs


  • To: Julien Grall <julien@xxxxxxx>
  • From: Edwin Torok <edvin.torok@xxxxxxxxxx>
  • Date: Tue, 8 Nov 2022 17:02:36 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jI8XVAPImvBtlvH0QDbvE7jiKZreGu3vGjC8uVGCc0Q=; b=ffNlGUsyX1F6sy9T0ECrc67PzgUOJTV9HWOWng021iWundEdJZU9S9oyFmx2rjpKItg2eGAr+fa3KqZrneKFNJJOyILH2bncncST4nvEdyG+YeqHjdJjLytt9zcS3uw/48CsPi8iRTQpk+FKW7BOoEQr9DB/xHJBbE8+d+/N1i4cP44E5vceLpKk47fTG0idijuTu9fswiXX/f/8Tm+OJbnJ2swlWE3L7+t+xYwjrjQgJFirUF0pMRpO+/hK41mDS4ORH4wAxZ6Ub1ZgNpNmDSKfCKbiSKMCLcc1iVDYk2p8CURWvq/5AYGZoNOJRVHzmM1JCgde7Ii3omoaGo41JQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lg7N7g9WAyY+45d9Gwqjub6g/IAPsQpT+fyJTbdfk6a+AtU0sL+JOrgn/jZKKiqUkZ+B90nfgn6CNkgmx4a1BjmU6eg3MoIRUpK9wX3phqYzUvGavlEfxSQLSGR/TyPySs/XimX2RR0tJ+2hOR9JsS+97SH3+JCyqIeADmp01FCd/sbxV/8bS5M5QY9tOrbZAHVwC42YArx4DKFPTCQyO6MIH10pURIwjsVxR3Fjl3dOV8xwWUWTuQuMAmWbV1fEi4KkarpecWvAKkexTc2w4IVm2ofOckhXdVPgrcEqCS0DXHG64lz6xODghoukR65RIwE/5wFmMNC8FFGwD6XJvQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, Christian Lindig <christian.lindig@xxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Tue, 08 Nov 2022 17:02:51 +0000
  • Ironport-data: A9a23:LYuBfqJjZepd5IxiFE+REZQlxSXFcZb7ZxGr2PjKsXjdYENS1mRSz DcbXTjUaavZYTH3KY8iPYm38EsP65PRy4BqHQplqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHv+kUrWs1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPdwP9TlK6q4mlB5wRuPaojUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5bEW9V1 vtJFQwHTU2DrM+k2oPqG/FV05FLwMnDZOvzu1lG5BSBUbMMZ8CGRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/VrpTSDpOBy+OGF3N79d9CURMMTgkGCo WHu9GXlGBAKcteYzFJp91r82r+Uwn+rBur+EpW29c9XqU+B/lVNDQZNbwCrpeLjshWhDoc3x 0s8v3BGQbIJ3E62StjwWTWorXjCuQQTM/JAHut/5AyTx6785weCGnNCXjNHcMYhtsI9WXotz FDht/PkAyZ+9oKcT321/62R6zi1PEA9IWYcaAceQAAC4t2lp5s85jrQSv5zHajzicf6cQwc2 BiPpSk6wr8V3cgC0v3n+Uid22784J/UUgQy+wPbGHq/6R90b5KkYIru7kXH6fFHL8CSSVzpU GU4pvVyJdsmVfml/BFhis1UdF11z55p6AHhvGM=
  • Ironport-hdrordr: A9a23:bwZuq6HLpPHT5q51pLqFS5HXdLJyesId70hD6qkvc3Fom52j/f xGws5x6fatskdrZJkh8erwW5Vp2RvnhNNICPoqTM2ftW7dySeVxeBZnMHfKljbdxEWmdQtsp uIH5IeNDS0NykDsS+Y2nj2Lz9D+qjgzEnAv463oBlQpENRGthdBmxCe2Sm+zhNNW177O0CZf +hD6R8xwaISDAyVICWF3MFV+/Mq5ngj5T9eyMLABYh9U2nkS6owKSSKWnY4j4uFxd0hZsy+2 nMlAL0oo+5teug9xPa32jPq7xLhdrazMdZDsDksLlUFtyssHfqWG1SYczGgNkHmpDq1L/sqq iKn/4UBbUw15oWRBDynfKi4Xi47N9k0Q6e9bbRuwqenSW+fkN1NyMJv/MmTjLJr0Unp91yy6 RNwiaQsIdWFwrJmGDn68HPTAwCrDv8nZKz+dRj8EC3fLFuH4O5l7Zvin99AdMFBmb3+YonGO 5hAIXV4+tXa0qTazTcsnN0yNKhU3wvFlPeK3Jy8fC9wnxThjR03kEYzMsQkjMJ8488UYBN46 DBPr5znL9DQ8cKZeZ2BfsHQ8GwFmvRKCi8eF66MBDiDuUKKnjNo5n47PE84/yrYoUByN8olJ HIQDpjxBoPkoLVeLizNbFwg2PwqT+GLEXQI+llluhEk6y5Qqb3OiueT11rm9e8opwkc7/mZ8 o=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY84fA+Ym2JRve3kKJcIO1APAKeK41MEgAgAAQaIA=
  • Thread-topic: [PATCH for-4.17 v3 07/15] CODING_STYLE(tools/ocaml): add 'make format' and remove tabs


> On 8 Nov 2022, at 16:03, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi,
> 
> On 08/11/2022 15:33, Edwin Török wrote:
>> See CODING_STYLE: Xen uses spaces, not tabs.
>> * OCaml code:
>> Using `ocp-indent` for now to just make minimal modifications in
>> tabs vs spaces and get the right indentation.
>> We can introduce `ocamlformat` later.
>> * C stubs:
>> just replace tabs with spaces now, using `indent` or `clang-format`
>> would change code too much for 4.17.
>> This avoids perpetuating a formatting style that is inconsistent with
>> the rest of Xen, and that makes preparing and submitting patches more
>> difficult (OCaml indentation tools usually only support spaces, not tabs).
>> Contains a bugfix for `abi-check` script to handle the change in the
>> amount of whitespace.
>> No functional change.
>> Signed-off-by: Edwin Török <edvin.torok@xxxxxxxxxx>
>> --
>> Reason for inclusion in 4.17:
>> - makes it easier to backport changes from master to 4.17
> 
> Right, but you will have the problem when backporting to 4.16 and older. So 
> the overhead will always be there for a couple of years.


There will always be more than one Xen release in support, which means we'd 
never be able to fix this.
At some point we need to decide to go ahead and just do it (which may or may 
not be 4.17)

The whitespace fixup needs to happen somewhere anyway, there are a couple of 
options:
* use git rebase/cherry-pick -Xignore-space-change to avoid backport failing to 
apply
* do a reformat on 4.16 branch too (backport the couple of lines of Makefile 
change and run 'make format' and commit the result)
* include the reformat as a prerequisite of the next security patch (I'd prefer 
not to, hence including it in 4.17)
* do the whitespace fixup prior to submission, turning a correctly formatted 
patch with spaces into an incorrectly formatted one with tabs. I wouldn't have 
minded doing this if the coding style said tabs,
I could've run my reformat tool locally and fix it up with 'sed' prior to 
submission. However this seems unnecessary overhead if doing this works 
actively against the existing coding style.

However if we put this into 4.17 and there are no new security issues 
discovered before 4.16 goes out of support then we'll be in a much better 
position for 4.18 onward.
There is still quite a lot of work outstanding in testing of oxenstored 
(updating my fuzzer for one), so I can't really predict at this point whether 
there are more security bugs in oxenstored or not,
so maybe we need to take this decision at 4.18 time? Not sure.

> 
>> - avoid perpetuating a different coding style (I thought tabs were
>>   mandated by Xen, and was about to fix up my editor config to match
>>   when I realized Xen already mandates the use of spaces)
>> - should make submitting patches for OCaml easier (OCaml indentation
>>   tools know only about spaces, so I either can't use them, or have to
>>   manually adjust indentation every time I submit a patch)
>> - it can be verified that the only change here is the Makefile change
>>   for the new rule, 'git log -p -1 -w' should be otherwise empty
> 
> While I understand the goal and support, this seems to be a bit too late to 
> do it in Xen 4.17 (we are only a couple of weeks away). At this stage of the 
> release we should only do bug fix.

I think it can be fairly easily proven that there is no functional change by 
rerunning the make format command manually, and by looking at the diff with 
ignore whitespace as suggested above.
I understand the reluctance in including it (which is why I was not sure 
whether to post it in the first place), but I think it might be beneficial to 
do it.
There is a large backlog of work in oxenstored that got piled up during the 
past couple of years of XSA work, and it'd be a lot easier to update and 
upstream those if we wouldn't have to worry
about indentation at all.

Usually patches on LCM and security branches are avoided to reduce the risk of 
breaking anything, but a reindentation patch should not really break anything 
(well other than the abi-check script in the build, but I fixed that to accept 
both ways).

One alternative would be that I add another step after reformat that runs sed 
and turns spaces back into tabs for now, and that way I can still run 'make 
format' at each step while preparing patches for master, or 4.17 or security 
patches and get something consistent, and that minimizes other whitespace 
changes, but it wouldn't completely eliminate them (e.g. there are pieces of 
code that are just wrongly indented, so there'd be at least a diff to fix all 
that).

> 
> This is clearly only a comesmetic change and there I would argue this should 
> be deferred to 4.18. That said the last call is from the RM.


Best regards,
--Edwin

> 
> Cheers,


> 
> 
> -- 
> Julien Grall


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.