From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: Re: [PATCH] gnu: Add rofi. Date: Tue, 24 May 2016 08:55:02 +0200 Message-ID: <20160524085502.2f095f2f@scratchpost.org> References: <20160520062952.314ba37f@scratchpost.org> <20160523042826.GA20265@jasmine> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b56FJ-0004uf-ON for guix-devel@gnu.org; Tue, 24 May 2016 02:55:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b56FD-0000I6-NO for guix-devel@gnu.org; Tue, 24 May 2016 02:55:16 -0400 Received: from dd1012.kasserver.com ([85.13.128.8]:53752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b56FD-0000Dc-GS for guix-devel@gnu.org; Tue, 24 May 2016 02:55:11 -0400 In-Reply-To: <20160523042826.GA20265@jasmine> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Leo Famulari Cc: guix-devel@gnu.org, Danny Milosavljevic On Mon, 23 May 2016 00:28:26 -0400 Leo Famulari wrote: > The failing test (helper_expand) seems to fail when it can't find > `which`. The failing test is test/helper-expand.c and it tries to do this: int main ( int argc, char ** argv ) { cmd_set_arguments ( argc, argv ); if ( setlocale ( LC_ALL, "" ) == NULL ) { fprintf ( stderr, "Failed to set locale.\n" ); return EXIT_FAILURE; } /** * Test some path functions. Not easy as not sure what is right output on travis. */ // Test if root is preserved. char *str = rofi_expand_path ( "/" ); TASSERT ( strcmp ( str, "/" ) == 0 ); g_free ( str ); // Test is relative path is preserved. str = rofi_expand_path ( "../AUTHORS" ); TASSERT ( strcmp ( str, "../AUTHORS" ) == 0 ); g_free ( str ); // Test another one. str = rofi_expand_path ( "/bin/false" ); TASSERT ( strcmp ( str, "/bin/false" ) == 0 ); g_free ( str ); // See if user paths get expanded in full path. str = rofi_expand_path ( "~/" ); <----- oh oh const char *hd = g_get_home_dir (); TASSERT ( strcmp ( str, hd ) == 0 ); g_free ( str ); str = rofi_expand_path ( "~root/" ); <--- oh oh TASSERT ( str[0] == '/' ); g_free ( str ); } And rofi_expand_path does char *rofi_expand_path ( const char *input ) { char **str = g_strsplit ( input, G_DIR_SEPARATOR_S, -1 ); for ( unsigned int i = 0; str && str[i]; i++ ) { // Replace ~ with current user homedir. if ( str[i][0] == '~' && str[i][1] == '\0' ) { g_free ( str[i] ); str[i] = g_strdup ( g_get_home_dir () ); <----------- oh oh } // If other user, ask getpwnam. else if ( str[i][0] == '~' ) { struct passwd *p = getpwnam ( &( str[i][1] ) ); <---------- oh oh if ( p != NULL ) { g_free ( str[i] ); str[i] = g_strdup ( p->pw_dir ); } } else if ( i == 0 ) { char * s = str[i]; if ( input[0] == G_DIR_SEPARATOR ) { str[i] = g_strdup_printf ( "%s%s", G_DIR_SEPARATOR_S, s ); g_free ( s ); } } } char *retv = g_build_filenamev ( str ); g_strfreev ( str ); return retv; } What should we do about it? The "which" part is just rofi trying to find out whether it has been checked out from git or expanded from a release tarball.