From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id AA5C7158094 for ; Sun, 17 Jul 2022 19:14:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AD5D5E0EA8; Sun, 17 Jul 2022 19:14:42 +0000 (UTC) Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 57D48E0EA8 for ; Sun, 17 Jul 2022 19:14:42 +0000 (UTC) Received: by mail-pj1-x1036.google.com with SMTP id fz10so9947922pjb.2 for ; Sun, 17 Jul 2022 12:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:date:to:cc:subject:message-id:mime-version:content-disposition; bh=0O3JcTP1QjfTRbN+xjPhrQnR8GaDRTdaq4vbxCkfjdY=; b=cvQ2ZyGRUQ4jumYrk2Ee+r4txd9bfvlR4jFLvPU+esFOUdp5b70SYJkeCjfMgevN4N 29LBp4z3NJYkBsQxBZCtdeNs902svYH4sh4j3qUoQ/GuTbW/+L+wI4x2f4XbAk664k++ lxZr7x1h8vwqfiA2pFduVNf5EFAs7rYnTfETrQ9mpj5FLMFz0RP0KAuoAL/miMZXrEof 3VJV9c9psAHG2hwzoMOJ2OdnE3H6yr/xn0hnpll1Vtn1/59JGDX4h9MtGVQNce1XoIUY bO6UiYM6RE8kUMeM36gVXGaO2CQz2ZM4hm1DlxETQG9d1cTSLJedxFvxwXzjBp2KPs50 G8yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:to:cc:subject:message-id:mime-version :content-disposition; bh=0O3JcTP1QjfTRbN+xjPhrQnR8GaDRTdaq4vbxCkfjdY=; b=Zy8DZDFhWHfy9D4cn0F7aNJOkthwCQ+ytw2uAbwbxIhht6wsi4cUPNbLyEKZRQAQAJ yz3hiQMAnZvz6Kdq/cBkG7QdQFU8XP3ZM8KJp2XPak6ZHHU93e2rZIXCBOujF5v+3vz0 vV36MY9w7GffFRzpXvaZpNY6Kq1kJz+UuPVA0sPfMwJ556Svmnioje/RRcoacp4g+rEp 46J2V+woEPsutdcmcmX+aVbDjYGVffiGWPoy3nrSr42lJaSv/DjFlXnmxFhvRsx/lPid LV0ejCFGrH42Zaaz+gesj8cXf27jo9Guv4wPb/bH2RjsYV7iKn3Ro2lFSzb0TA+FvIfi U+5A== X-Gm-Message-State: AJIora/Q2A3U7aYJffuuehyKe/qaAv4EvVYrQqYUIdN+MPW0U8OA3Wxd MQ0SDwMReZh9tvx0kGdZPHFBQ/SoXRE= X-Google-Smtp-Source: AGRyM1ssI4uzQBrIEjPnOZ3o8JNLMhfwNwdVU6mPw/hcxIfgW/JlmKDmDzsuaSTH2zNlHd5G6jdGcw== X-Received: by 2002:a17:902:e542:b0:16b:fcbe:7b90 with SMTP id n2-20020a170902e54200b0016bfcbe7b90mr24765334plf.90.1658085281117; Sun, 17 Jul 2022 12:14:41 -0700 (PDT) Received: from gmail.com ([43.252.250.150]) by smtp.gmail.com with ESMTPSA id c14-20020a170903234e00b0016c0593876csm7624663plh.157.2022.07.17.12.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 12:14:40 -0700 (PDT) From: listout X-Google-Original-From: listout Date: Mon, 18 Jul 2022 00:44:39 +0530 To: gentoo-soc Cc: sam , dilfridge Subject: [gentoo-soc] Week 5 Report for Musl support expansion to support GNOME desktop Message-ID: <20220717191439.6fzdw2u5636k5tbc@gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-soc@lists.gentoo.org Reply-to: gentoo-soc@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Archives-Salt: 31d4cd7f-1f7c-4ca0-9837-7763a111d57c X-Archives-Hash: 5cf8887e8f67fda12d8ac479832b2c5e Hey there folks. With the end of week 5 I'm once again here with my weekly report. As previous weeks this week too has been quite uneventful. I have been working on fixing miscellaneous bugs, constantly sharing my code with mentors and getting review to increase code quality. One such example would be of the debugedit patch [1], where I was replacing every instance of the error function with err for systems that does not have error.h header. I patch got big and was my mentor sam_ was second guessing to add it into ::gentoo. Upon review from developer blueness, who gave the advice to use a macro to redefine the err function with error function if error.h is not present. After a bit of research and help from blueness I came up with something like this: ``` #ifdef HAVE_ERROR_H #include #else #include #define error(status, errno, ...) err(status, __VA_ARGS__) #endif ``` Another one such example where I learned about a another macro trick was patching mysql-connector-c package [2]. This package not only helped me learn about the checking presence of functions and headers using various build tools (like GNU autotools, cmake, and meson), in this case it was cmake. I looked for the presence of three specific functions and set compile definitions respectively. Here is is the code snippet that does it: ``` check_symbol_exists(res_ninit "resolv.h" HAVE_RES_NINIT_FUNCTION) check_symbol_exists(res_nsearch "resolv.h" HAVE_RES_NSEARCH_FUNCTION) check_symbol_exists(res_nclose "resolv.h" HAVE_RES_NCLOSE_FUNCTION) IF (HAVE_RES_NINIT_FUNCTION) add_compile_definitions(HAVE_RES_NINIT) ENDIF(HAVE_RES_NINIT_FUNCTION) IF (HAVE_RES_NSEARCH_FUNCTION) add_compile_definitions(HAVE_RES_NSEARCH) ENDIF(HAVE_RES_NSEARCH_FUNCTION) IF (HAVE_RES_NCLOSE_FUNCTION) add_compile_definitions(HAVE_RES_NCLOSE) ENDIF(HAVE_RES_NCLOSE_FUNCTION) ``` With this the cmake build systems will check the resolv.h file for presence of res_ninit, res_nsearch, and res_nclose functions and set the compile definitions accordingly. We can then use this definitions to use the _res_n*_ fucntions which are thread safe or the non-thread-safe alternative ones. Last but not the least, the libratbag package [3] taught me how to perform the same things, check presence of functions and headers but using meson build system. An example to use meson build system to check for whether error.h is present on system and set a define accordingly would be: ``` error_exists = cc.has_header('error.h') if error_exists add_global_arguments('-DHAVE_ERROR_H', language : 'c') endif ``` The above snippet check is the error.h header is present in the current system, or provided by the current libc and then sets the HAVE_ERROR_H if it's true or if error.h is indeed present. So with this I'm able to now navigate around three major build systems to handle missing functions and headers which seems to be quite common when it comes to musl. Apart from all these things I'm also trying to upstream a few samba patches that would musl users [4], came across a GNOME bug where where mutter seem to be hitting a race condition on musl (from the comments on source code) whereas it's not the same on glibc. There is an open issue for this upstrem [5], so I'm still waiting for the developers to reply. However the original author of the issue does provide us with a workaround patch which seems to be working. This mutter issue is very specific to Xorg as I've not been able to reproduce the issue when using Wayland. I think this is a concise enough report for this week, there were a few minor patches/fixes that I did but it's nothing worthy mentioning of. Hope to find and fix more bugs in the future. Till then, long live Gentoo. [1]: https://github.com/gentoo/gentoo/pull/26223 [2]: https://github.com/gentoo/gentoo/pull/26353 [3]: https://github.com/gentoo/gentoo/pull/26437 [4]: https://gitlab.com/samba-team/samba/-/merge_requests/2617 [5]: https://gitlab.gnome.org/GNOME/mutter/-/issues/2103 -- Regards, listout