From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 0853C7030C; Fri, 5 Mar 2021 06:50:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0853C7030C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614916203; bh=HT8GzNznGm5ivBeFwN0wsGXtrVeCTn62n3taa8eOffg=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=B+4v9zNyrVOwYDMy8M4auaiqM71yt6sgEqmsW1wuCwQ77vXyX8GivORUMzCI4MAYV BjR4qWAmhFOrBIBcdWZqQjWfQfhiyqsSLMJeG3BoaY+pI3efYjoBiHPEZimMlFX8Dw LYJ/KYiXvrjl+xjfUhMrxdXwly9a0QKtH5EzausU= Received: from smtp45.i.mail.ru (smtp45.i.mail.ru [94.100.177.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E8BDE7030C for ; Fri, 5 Mar 2021 06:50:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E8BDE7030C Received: by smtp45.i.mail.ru with esmtpa (envelope-from ) id 1lI1TT-00044B-RT; Fri, 05 Mar 2021 06:50:00 +0300 Date: Fri, 5 Mar 2021 06:50:08 +0300 To: Igor Munkin Message-ID: <20210305035008.hya3vediwfthybv5@tkn_work_nb> References: <524c0ce8acc18111ab4c8b36e383ff192779c780.1613661908.git.alexander.turenko@tarantool.org> <20210226181158.GD9042@tarantool.org> <20210303180257.ktityub26cd27ogh@tkn_work_nb> <20210304222106.GM9042@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210304222106.GM9042@tarantool.org> X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92A98208ECBDD29F587EDFE9EAEF5928E178D408998122C74182A05F5380850401DBC4ACDF1DA5262A637242350CEEC77C077C9B047AF0563474BA064BA3AA6D4 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7646B74825E00C605EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CDA089757FB31C668638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CFC18DCDA8D016604177C24BC5D0102D6504AA58EDB8624A9A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C37EF884183F8E4D67117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CF71BAACC4CD15A3B0BA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B6291F04B1A482BE1D76E601842F6C81A1F004C90652538430CDED94BCBF13EF3B93EC92FD9297F6718AA50765F79006373AFABB501D265F08A7F4EDE966BC389F395957E7521B51C24C7702A67D5C33162DBA43225CD8A89FC0F9454058DFE53C57739F23D657EF2BB5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DBAF038BB36E94EA6B574AF45C6390F7469DAA53EE0834AAEE X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24A6D60772A99906F8E1CD14B953EB46D45A6B4D156CC7C42355D89D7DBCDD132 X-C1DE0DAB: 0D63561A33F958A5557B1369AEF74A9153FD8EBC5CAA32CEDCE256E4D10777D2D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3468964757141B82E04F9201CCD70A3BCA6A22638BBC718A0D4FD65F1AFF3457AF035E9DF563C69CBB1D7E09C32AA3244C13B0EC6F585B1EEA24055F2EA944487AF165894D92D62706FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojXmjzTEesUQGNhostBRhPfA== X-Mailru-Sender: FFAA8E4AEE17E37C3731A083A1A85ADEAF76B043C62B4BAEA3062C094B70124BB7EA9FE7735C3DBFC664A44C781FCEA7C77752E0C033A69EDF9F2CE1E9CF805D8CD356D4F938FF726C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2] tools: fix luacheck invocation in different cases X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Alexander Turenko via Tarantool-patches Reply-To: Alexander Turenko Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Aside of the changes below I rebased my patch on top of the latest master and verified that it applies cleanly on 2.7 and 2.6 as well. Force-pushed Totktonada/fix-luacheck-invocation to 40fc60b070c1a4474dd9173b1e72a8c425bd28d9. > > So I would keep the proposed solution, because it still looks as the > > simplest one. > > Yes, your one is quite robust and covers everything. BTW, it worth to > mention the fact, in-source build is covered via .luacheckrc (in case of > LuaJIT sources and its autogenerated files). I added the brief explanation. Thank you for participating in the problem investigation! | # outside of ${dir} or when ${dir} is not a real path. | # * Using of a path with symlink components in --exclude-files. | # | +# We should exclude the build directory (when it is inside the | +# source tree), at least because it contains LuaJIT's generated | +# files and the temporary directory for testing (test/var). | +# | +# .luacheckrc provides corresponding exclusion rules for the | +# in-source build case (`cmake .`). | +# | # [1]: https://github.com/mpeterv/luacheck/issues/208 | # | set(EXCLUDE_FILES) > > Igor, please, agree explicitly or challenge my point. > > I explicitly agree and you still have my LGTM (but I see no reaction > about the nit below). Feel free to proceed with the patch. Sorry. I answered you in my mind, but forgot to write my answer :) Responded below. > > BTW, while looking into the problem with Igor, we found that luajit's > > luacheck rule fails on source / build paths with symlinks components. > > The solution is to use real paths everywhere. > > I take this upon myself. Thank you! I should mention that there is the problem with the LuaJIT CMake rule in the commit message. | -Now `make luacheck` gracefully handles different cases: in-source | +Now `make luacheck` gracefully handles different cases[^1]: in-source | and out-of-source build (within the source tree or outside), current | working directory as a real path or with symlink components. | | <...> | | +[^1]: We have the similar problems with LuaJIT's luacheck rule. They | + will be fixed in a separate patch. | | [1]: https://github.com/mpeterv/luacheck/issues/208 | | +Reviewed-by: Sergey Bronnikov | +Reviewed-by: Igor Munkin > > > > +# > > > > +# Whether a file is descendant to a directory. > > > > +# > > > > +# If the file is the directory itself, the answer is FALSE. > > > > +# > > > > +function(file_is_in_directory varname file dir) > > > > + file(RELATIVE_PATH file_relative "${dir}" "${file}") > > > > + if (file_relative STREQUAL "") > > > > + # and is the same directory. > > > > + set(${varname} FALSE PARENT_SCOPE) > > > > + elseif (file_relative STREQUAL "..") > > > > + # inside a (so it is a directory too), not > > > > + # vice versa. > > > > + set(${varname} FALSE PARENT_SCOPE) > > > > > > It looks this branch is excess and is covered by the next one (if you > > > remove the trailing slash). Clarified in the following comment. Thanks for pointing it out! | function(file_is_in_directory varname file dir) | file(RELATIVE_PATH file_relative "${dir}" "${file}") | + | + # Tricky point: one may find and | + # if-branches quite similar and coalesce | + # them as . However it'll match paths like | + # "..." or "..foo/bar", whose are definitely descendant to | + # the directory. | if (file_relative STREQUAL "") | # and is the same directory. | set(${varname} FALSE PARENT_SCOPE) > > > > > > > + elseif (file_relative MATCHES "^\\.\\./") > > > > + # somewhere outside of the . > > > > + set(${varname} FALSE PARENT_SCOPE) > > > > + else() > > > > + # is descendant to . > > > > + set(${varname} TRUE PARENT_SCOPE) > > > > + endif() > > > > +endfunction()