LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to build cups-bjnp-2.0.1 (https://www.linuxquestions.org/questions/slackware-14/how-to-build-cups-bjnp-2-0-1-a-4175652442/)

TurboBlaze 04-19-2019 12:20 PM

How to build cups-bjnp-2.0.1
 
Hi. I tried to build cups-bjnp-2.0.1 via SBo, like this
Code:

cd /tmp
wget https://slackbuilds.org/slackbuilds/14.2/system/cups-bjnp.tar.gz -P /tmp
tar xf cups-bjnp.tar.gz
cd /tmp/cups-bjnp && curl -O https://netix.dl.sourceforge.net/project/cups-bjnp/cups-bjnp/2.0.1/cups-bjnp-2.0.1.tar.gz
sed -i 's|-1.2|-2.0.1|' /tmp/cups-bjnp/cups-bjnp.SlackBuild
./cups-bjnp.SlackBuild

but I have this error:
Code:

bjnp-commands.c: In function «bjnp_set_command_header»:
bjnp-commands.c:40:5: error: «strncpy» output truncated before terminating nul copying 4 bytes from a string of the same length [-Werror=stringop-truncation]
    strncpy(cmd->header.BJNP_id, BJNP_STRING, sizeof(cmd->header.BJNP_id));
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bjnp-commands.c is have code with this line:
Code:

static void
bjnp_set_command_header(uint8_t dev_type, uint16_t seq_no, uint16_t session_id, bjnp_command_t *cmd, char cmd_code,
                        int command_len)
{
    /*
    * Set command buffer with command code, session_id and lenght of payload
    * Returns: sequence number of command
    */
    strncpy(cmd->header.BJNP_id, BJNP_STRING, sizeof(cmd->header.BJNP_id));
    cmd->header.dev_type = dev_type;
    cmd->header.cmd_code = cmd_code;
    cmd->header.unknown1 = htons(0);
    cmd->header.payload_len = htonl(command_len - bjnp_header_size);
    cmd->header.seq_no = htons(seq_no);
    cmd->header.session_id = htons(session_id);
}

How it can be fixed?

Thanks

bassmadrigal 04-19-2019 03:32 PM

I tried this on my 14.2 system and I was able to compile it correctly.

Code:

wget https://slackbuilds.org/slackbuilds/14.2/system/cups-bjnp.tar.gz
tar xvf cups-bjnp.tar.gz
sed -i 's|-1.2|-2.0.1|g' cups.*
. cups.info
wget $DOWNLOAD
sh cups-bjnp.SlackBuild


TurboBlaze 04-20-2019 04:19 AM

bassmadrigal, thanks for your answer.
Probably you are use ./ap/cups-2.1.4-x86_64-1.txz
but I use ./ap/cups-2.2.11-x86_64-1.txz from Slackware64-current.

Regards,
Blaze

bassmadrigal 04-20-2019 05:16 AM

You're correct, I did try it with the stock cups from 14.2. I then grabbed the source from -current for cups and upgraded my cups to that version (I don't have a printed hooked up, so I'm not worried about breakage, and if something unexpected does break, I can reinstall the stock package). I then rebuilt cups-bjnp v2.0.1 and it worked fine.

I'm not sure if you have a full -current install or have just upgraded occasional packages on 14.2 like me...

Otherwise, you can likely bypass this warning-gone-error by adding -Wno-stringop-truncation to the CFLAGS variable in the SlackBuild.

glorsplitz 04-20-2019 09:32 AM

have used bjnp over the years without issue, without using slackbuilds, the following was done using -current all up to date

Code:

wget https://netix.dl.sourceforge.net/project/cups-bjnp/cups-bjnp/2.0.1/cups-bjnp-2.0.1.tar.gz
Code:

tar xvf cups-bjnp-2.0.1.tar.gz
Code:

cd cups-bjnp-2.0.1
based on strncpy calls here should be simple memcpy change strncpy to memcpy
Code:

nano bjnp-commands.c
then
Code:

./configure --with-cupsbackenddir=/usr/lib64/cups/backend
Code:

make
./bjnp was able to find my printer

then
Code:

make install
if works for you

TurboBlaze 04-20-2019 01:41 PM

glorsplitz, I changed strncpy to memcpy and builded tgz package without any troubles.

Guys, thank you so much!

Regards,
Blaze


All times are GMT -5. The time now is 11:35 AM.