From nobody Sun Feb 8 17:41:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615300021; cv=none; d=zohomail.com; s=zohoarc; b=T2YtUZqwnCQcN7x7ybUd/gGD8OcbEm+VY2wyTzBONYdmOM8obYed+bLTxiXeciE6XBUylZjln8yElMNQEnKScpdQBBgYhH6a2vV9tQLK3ePab8a+vqEA8BZrMmUiaqRoBP/qEIf3eGdfGKLD42J7e7muLAVFE2iXg08HkOhXu78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615300021; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ii+aIpNh8KjUjOanF1+j4SJSyGHr/Q8ZDmQZlEMPYPc=; b=UX82fWsTwOHGQDuW39p25rMOGeoSfo4vzrIij9+CR+liKOkdt1nNEv8vUT41QIiaOata6OAD6auPnVqBv/VhbVkjnAqw0lKQ3y96PRvJvme9ND/8ttDF1zvK3coRkenYhj0UijrZZoiZxfwEFZ2TD0WSlJ354YX+DqaU7rrHB90= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1615300021013341.14677439143395; Tue, 9 Mar 2021 06:27:01 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-134-dD9EUFIROgSd-VfouZsUyg-1; Tue, 09 Mar 2021 09:26:57 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 50C921934105; Tue, 9 Mar 2021 14:26:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 29D3160C13; Tue, 9 Mar 2021 14:26:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E0C851809C8C; Tue, 9 Mar 2021 14:26:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 129EQYtp016612 for ; Tue, 9 Mar 2021 09:26:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4040B104FF; Tue, 9 Mar 2021 14:26:34 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id B72EA196E3 for ; Tue, 9 Mar 2021 14:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615300019; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ii+aIpNh8KjUjOanF1+j4SJSyGHr/Q8ZDmQZlEMPYPc=; b=PUtKyDPAquXkq50QykQfWS3JK5Y/URykFRocMwTJs4cghaK0+usFcmKvIHdZQ+60JzTms1 ErV67oPU95eW4Gaar5kEfrh5y8joNxeki/1/iVouG8PSewmlnW3GNDf+9V+6TNjlJUBBPR cDBWY+jP5JVUzpopg91cEspCOPKxkU8= X-MC-Unique: dD9EUFIROgSd-VfouZsUyg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/4] docs: Discourage use of some glib functions Date: Tue, 9 Mar 2021 15:26:25 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Unfortunately, not all GLib functions provide the level of security we want, or behave how we want. So far, g_file_get_contents() and g_get_host_name() have been identified. Signed-off-by: Michal Privoznik --- docs/glib-adoption.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/glib-adoption.rst b/docs/glib-adoption.rst index f969ac80a1..bbc27fed6d 100644 --- a/docs/glib-adoption.rst +++ b/docs/glib-adoption.rst @@ -52,3 +52,20 @@ Objects https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type= .html =20 Prefer ``GObject`` instead. + + +Forbidden functions +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +There are some functions where Libvirt offers superior quality to GLib. In +those cases, GLib functions must NOT be used and Libvirt functions should = be +used instead. + +``g_file_get_contents`` + Use ``virFileReadAll`` instead. The GLib function reads the entire file + into the memory without possibility to provide any limit on the buffer + size. + +``g_get_host_name`` + Prefer ``virGetHostname``. The GLib function caches the hostname and t= hus + does not reflect (possible) hostname changes. --=20 2.26.2