From owner-svn-ports-head@freebsd.org Sat May 25 15:31:21 2019 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1052515AEEE5; Sat, 25 May 2019 15:31:21 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A298073AF2; Sat, 25 May 2019 15:31:20 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D5C66401; Sat, 25 May 2019 15:31:20 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PFVKsO010405; Sat, 25 May 2019 15:31:20 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PFVKMu010403; Sat, 25 May 2019 15:31:20 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201905251531.x4PFVKMu010403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sat, 25 May 2019 15:31:20 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r502579 - in head/audio/xmms2-scrobbler: . files X-SVN-Group: ports-head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: in head/audio/xmms2-scrobbler: . files X-SVN-Commit-Revision: 502579 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A298073AF2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 15:31:21 -0000 Author: eugen Date: Sat May 25 15:31:19 2019 New Revision: 502579 URL: https://svnweb.freebsd.org/changeset/ports/502579 Log: audio/xmms2-scrobbler: re-apply fix correctly Wrong APIFIX_EXTRA_PATCHES_ON changed to right APIFIX_EXTRA_PATCHES Thanks to tobik for reporting this. Bump PORTREVISION. PR: 220992 Submitted by: Eugene Zheganin Reported by: tobik Added: head/audio/xmms2-scrobbler/files/extra-patch-xmms2-scrobbler.c - copied unchanged from r502577, head/audio/xmms2-scrobbler/files/extra-patch-xmms2-scrobbler.c Modified: head/audio/xmms2-scrobbler/Makefile Modified: head/audio/xmms2-scrobbler/Makefile ============================================================================== --- head/audio/xmms2-scrobbler/Makefile Sat May 25 15:12:07 2019 (r502578) +++ head/audio/xmms2-scrobbler/Makefile Sat May 25 15:31:19 2019 (r502579) @@ -3,7 +3,7 @@ PORTNAME= xmms2-scrobbler PORTVERSION= 0.4.0 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= audio MASTER_SITES= ftp://ftp.code-monkey.de/pub/${PORTNAME}/ @@ -24,7 +24,11 @@ PORTDOCS= README SUB_FILES= pkg-message -OPTIONS_DEFINE= DOCS +OPTIONS_DEFINE= APIFIX DOCS +OPTIONS_DEFAULT= APIFIX + +APIFIX_DESC= Apply fix for Last.fm API 1.x +APIFIX_EXTRA_PATCHES= ${FILESDIR}/extra-patch-xmms2-scrobbler.c post-install: @${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/xmms2-scrobbler Copied: head/audio/xmms2-scrobbler/files/extra-patch-xmms2-scrobbler.c (from r502577, head/audio/xmms2-scrobbler/files/extra-patch-xmms2-scrobbler.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/audio/xmms2-scrobbler/files/extra-patch-xmms2-scrobbler.c Sat May 25 15:31:19 2019 (r502579, copy of r502577, head/audio/xmms2-scrobbler/files/extra-patch-xmms2-scrobbler.c) @@ -0,0 +1,196 @@ +--- src/xmms2-scrobbler.c.orig 2009-12-30 17:04:01 UTC ++++ src/xmms2-scrobbler.c +@@ -140,93 +140,126 @@ signal_handler (int sig) + keep_running = false; + } + +-static size_t +-handle_handshake_reponse (void *rawptr, size_t size, size_t nmemb, +- void *data) +-{ +- Server *server = data; +- size_t total = size * nmemb, left = total; +- char *ptr = rawptr, *newline; +- int len; ++char * get_line_from_response (char *answer, int lfpos) { ++ int lfpositions[10]; ++ int i, k, lfcounter, start, end, resultlen; + +- newline = memchr (ptr, '\n', left); +- if (!newline) { +- fprintf (stderr, "no newline (1)\n"); +- return total; +- } ++ char *result; + +- *newline = 0; ++#ifdef DEBUG ++ fprintf (stderr, "DEBUG: got string: %s\n", answer); ++#endif + +- if (strcmp (ptr, "OK")) { +- fprintf (stderr, "handshake failed\n"); +- return total; ++ /* marking the string */ ++ i = 0; ++ lfcounter = 0; ++ while (answer[i] != '\0') { ++ if (answer[i] == '\n' && lfcounter < 10) { ++ lfpositions[lfcounter] = i; ++ lfcounter++; ++#ifdef DEBUG ++ fprintf (stderr, "DEBUG: got LF location: %d\n", i); ++#endif + } ++ i++; ++ } ++ /* getting the actual line */ ++ /* getting the size of it */ + +- len = newline - ptr + 1; ++ start = lfpos - 1; ++ end = lfpos; ++#ifdef DEBUG ++ if (start >= 0) { ++ fprintf (stderr, "DEBUG: requested line starts at char no. %d and ends at %d.\n", lfpositions[start], lfpositions[end]); ++ } else { ++ fprintf (stderr, "DEBUG: requested line starts at the start of string and ends at char no. %d.\n", lfpositions[end]); ++ } ++#endif + +- left -= len; +- ptr += len; ++ if (start >= 0) { ++ resultlen = lfpositions[end] - lfpositions[start] + 1; ++ } else { ++ resultlen = lfpositions[end] + 1; ++ } ++#ifdef DEBUG ++ fprintf (stderr, "DEBUG: requested line will need %d bytes.\n", resultlen); ++#endif ++ result = malloc(resultlen); ++ bzero(result, resultlen); + +- newline = memchr (ptr, '\n', left); +- if (!newline) { +- fprintf (stderr, "no newline (1)\n"); +- return total; ++ /* bytecopying the line */ ++#ifdef DEBUG ++ if (start >= 0) { ++ fprintf (stderr, "DEBUG: copying the string from char no. %d to %d.\n", lfpositions[start], lfpositions[end]); ++ } else { ++ fprintf (stderr, "DEBUG: copying the string from the beginning to char no. %d.\n", lfpositions[end]); ++ } ++#endif ++ k = 0; ++ if (start >= 0) { ++ i = lfpositions[start]; ++ } else { ++ i = 0; ++ } ++ while (i < lfpositions[end]) { ++ /* don't copy LF themselves */ ++ if (answer[i] != '\n') { ++ result[k] = answer[i]; ++ k++; + } ++ i++; ++ } + +- *newline = 0; +- +- len = newline - ptr + 1; ++#ifdef DEBUG ++ fprintf (stderr, "DEBUG: returning string: %s\n", result); ++#endif ++ return(result); ++} + +- if (len > 255) { +- fprintf (stderr, "session ID is too long (%i characters)\n", len); +- return total; +- } ++static size_t ++handle_handshake_reponse (void *rawptr, size_t size, size_t nmemb, ++ void *data) ++{ ++ Server *server; ++ size_t total, left; ++ char *ptr, *status, *sessionid, *np_url, *subm_url; + +- strcpy (server->session_id, ptr); ++ server = data; ++ ptr = rawptr; ++ total = size * nmemb; ++ left = total; + +- left -= len; +- ptr += len; ++#ifdef DEBUG ++ fprintf (stderr, "DEBUG: got string \"%s\".\n", rawptr); ++#endif + +- /* now playing URL */ +- newline = memchr (ptr, '\n', left); +- if (!newline) { +- fprintf (stderr, "no newline (2)\n"); +- return total; ++ status = get_line_from_response(rawptr, 0); ++ ++ if (strcmp(status, "OK") != 0) { ++ fprintf (stderr, "WARNING: handshake failed: %s.\n", status); ++ return(total); + } + +- *newline = 0; +- +- len = newline - ptr + 1; +- +- if (len > 255) { +- fprintf (stderr, "now_playing URL is too long " +- "(%i characters)\n", len); +- return total; ++ sessionid = get_line_from_response(rawptr, 3); ++ if (strlen(sessionid) > 255) { ++ fprintf (stderr, "ERROR: session ID is too long (%ld characters).\n", strlen(sessionid)); ++ return(total); + } ++ strcpy (server->session_id, sessionid); + +- strcpy (server->np_url, ptr); +- +- left -= len; +- ptr += len; +- +- /* submission URL */ +- newline = memchr (ptr, '\n', left); +- if (!newline) { +- printf("no newline (3)\n"); +- return total; ++ np_url = get_line_from_response(rawptr, 6); ++ if (strlen(np_url) > 255) { ++ fprintf (stderr, "ERROR: nowplaying URL is too long (%ld characters).\n", strlen(np_url)); ++ return(total); + } ++ strcpy (server->np_url, np_url); + +- *newline = 0; +- +- len = newline - ptr + 1; +- +- if (len > 255) { +- fprintf (stderr, "submission URL is too long " +- "(%i characters)\n", len); +- return total; ++ subm_url = get_line_from_response(rawptr, 9); ++ if (strlen(sessionid) > 255) { ++ fprintf (stderr, "ERROR: submission URL is too long (%ld characters).\n", strlen(subm_url)); ++ return(total); + } +- +- strcpy (server->subm_url, ptr); ++ strcpy (server->subm_url, subm_url); + + fprintf (stderr, "got:\n'%s' '%s' '%s'\n", + server->session_id, server->np_url, server->subm_url);